﻿Namespace ControlLibrary
    ''' <summary>A context menu object that can be used with the dbiWSF Objects.</summary>
    Public Class dbiWSFObjectMenu
        Inherits System.Windows.Forms.ContextMenuStrip

#Region "Private Properties"
        'The WSFObject used for handling the objects and their data
        Private l_MyWSFObjects As dbiWSF.FrameworkObjects.objWSFObjects
        'The Business rules used by the Context Menu
        Private l_MyBusinessRules As dbiWSF.BusinessRulesAndSupport.BusinessRuleObjects

        'The object that the Context Menu was built around
        Private l_MyObject As Object

        'Variables used for determining if specific items will appear in the Context Menu
        Private l_ShowLoadingDockTransfers As Boolean = True
        Private l_ShowShipmentTransfers As Boolean = True
        Private l_ShowLoadingDockExceptionAffectedMenu As Boolean = True
        Private l_ShowRecurrenceLoadingDockExceptionAffectedMenu As Boolean = True
        Private l_ShowLoadingDockExceptionUnAffectedMenu As Boolean = True
        Private l_ShowRecurrenceLoadingDockExceptionUnAffectedMenu As Boolean = True
        Private l_ShowLoadingDockCargoTypes As Boolean = True
        Private l_ShowWarehouseMaintenance As Boolean = True
        Private l_ShowLoadingDockMaintenance As Boolean = True
        Private l_ShowShipmentMaintenance As Boolean = True
        Private l_ShowOrderHeaderMaintenance As Boolean = True
        Private l_ShowOrderDetailMaintenance As Boolean = True


        'Internal collections used with LoadingDock Exceptions and Recurrence LoadingDock Exceptions
        Private l_AffectedLoadingDocks As New System.Collections.Generic.List(Of dbiWSF.FrameworkObjects.objLoadingDock)
        Private l_UnAffectedLoadingDocks As New System.Collections.Generic.List(Of dbiWSF.FrameworkObjects.objLoadingDock)

        'Business Rule variables
        Private l_BusinessRulesOnRemove As Boolean = True
        Private l_BusinessRulesOnChange As Boolean = True
        Private l_BusinessRulesOnAdd As Boolean = True
        Private g_BusinessRulesDialog As dbiWSF.Dialogs.dlgBusinessRule
        Private g_EventArg As Object
        Private g_EventArgMethod As dbiWSF.Dialogs.EventMethods

#End Region

#Region "Public Properties"
        ''' <summary>The main WSFObject used for handling the objects and their data</summary>
        Public Property WSFObjects() As dbiWSF.FrameworkObjects.objWSFObjects
            Get
                Return l_MyWSFObjects
            End Get
            Set(ByVal value As dbiWSF.FrameworkObjects.objWSFObjects)
                l_MyWSFObjects = value
            End Set
        End Property

        ''' <summary>The Business rules used by the Context Menu</summary>
        Public Property MyBusinessRules() As dbiWSF.BusinessRulesAndSupport.BusinessRuleObjects
            Get
                Return l_MyBusinessRules
            End Get
            Set(ByVal value As dbiWSF.BusinessRulesAndSupport.BusinessRuleObjects)
                l_MyBusinessRules = value
                If value IsNot Nothing Then
                    Me.g_BusinessRulesDialog = New dbiWSF.Dialogs.dlgBusinessRule(l_MyBusinessRules)
                End If
            End Set
        End Property

        ''' <summary>Public Property used to determine if users will be given the option to Transfer LoadingDocks using the Context Menu</summary>
        ''' <returns>Boolean: If the item will appear in the menu</returns>
        Public Property ShowLoadingDockTransfers() As Boolean
            Get
                Return l_ShowLoadingDockTransfers
            End Get
            Set(ByVal value As Boolean)
                l_ShowLoadingDockTransfers = value
            End Set
        End Property

        ''' <summary>Public Property used to determine if users will be given the option to Transfer Shipments using the Context Menu</summary>
        ''' <returns>Boolean: If the item will appear in the menu</returns>
        Public Property ShowShipmentTransfers() As Boolean
            Get
                Return l_ShowShipmentTransfers
            End Get
            Set(ByVal value As Boolean)
                l_ShowShipmentTransfers = value
            End Set
        End Property

        ''' <summary>Public Property used to determine if users will be shown a list of all LoadingDocks affected by a LoadingDock Exception</summary>
        ''' <returns>Boolean: If the item will appear in the menu</returns>
        Public Property ShowLoadingDockExceptionAffectedMenu() As Boolean
            Get
                Return l_ShowLoadingDockExceptionAffectedMenu
            End Get
            Set(ByVal value As Boolean)
                l_ShowLoadingDockExceptionAffectedMenu = value
            End Set
        End Property

        ''' <summary>Public Property used to determine if users will be shown a list of all LoadingDocks affected by a Recurring LoadingDock Exception</summary>
        ''' <returns>Boolean: If the item will appear in the menu</returns>
        Public Property ShowRecurrenceLoadingDockExceptionAffectedMenu() As Boolean
            Get
                Return l_ShowRecurrenceLoadingDockExceptionAffectedMenu
            End Get
            Set(ByVal value As Boolean)
                l_ShowRecurrenceLoadingDockExceptionAffectedMenu = value
            End Set
        End Property

        ''' <summary>Public Property used to determine if users will be shown a list of all LoadingDocks Unaffected by a LoadingDock Exception</summary>
        ''' <returns>Boolean: If the item will appear in the menu</returns>
        Public Property ShowLoadingDockExceptionUnAffectedMenu() As Boolean
            Get
                Return l_ShowLoadingDockExceptionUnAffectedMenu
            End Get
            Set(ByVal value As Boolean)
                l_ShowLoadingDockExceptionUnAffectedMenu = value
            End Set
        End Property

        ''' <summary>Public Property used to determine if users will be shown a list of all LoadingDocks Unaffected by a Recurring LoadingDock Exception</summary>
        ''' <returns>Boolean: If the item will appear in the menu</returns>
        Public Property ShowRecurrenceLoadingDockExceptionUnAffectedMenu() As Boolean
            Get
                Return l_ShowRecurrenceLoadingDockExceptionUnAffectedMenu
            End Get
            Set(ByVal value As Boolean)
                l_ShowRecurrenceLoadingDockExceptionUnAffectedMenu = value
            End Set
        End Property

        ''' <summary>Public Property used to determine if users will be shown a list of all Cargo Types, and how they relate to the LoadingDock</summary>
        ''' <returns>Boolean: If the item will appear in the menu</returns>
        Public Property ShowLoadingDockCargoTypes() As Boolean
            Get
                Return l_ShowLoadingDockCargoTypes
            End Get
            Set(ByVal value As Boolean)
                l_ShowLoadingDockCargoTypes = value
            End Set
        End Property

        ''' <summary>Public Property used to determine if users will be shown menu items for adding/removing a Warehouse</summary>
        ''' <returns>Boolean: If the items will appear in the menu</returns>
        Public Property ShowWarehouseMaintenance() As Boolean
            Get
                Return l_ShowWarehouseMaintenance
            End Get
            Set(ByVal value As Boolean)
                l_ShowWarehouseMaintenance = value
            End Set
        End Property

        ''' <summary>Public Property used to determine if users will be shown menu items for adding/removing a LoadingDock</summary>
        ''' <returns>Boolean: If the items will appear in the menu</returns>
        Public Property ShowLoadingDockMaintenance() As Boolean
            Get
                Return l_ShowLoadingDockMaintenance
            End Get
            Set(ByVal value As Boolean)
                l_ShowLoadingDockMaintenance = value
            End Set
        End Property

        ''' <summary>Public Property used to determine if users will be shown menu items for adding/removing a Shipment</summary>
        ''' <returns>Boolean: If the items will appear in the menu</returns>
        Public Property ShowShipmentMaintenance() As Boolean
            Get
                Return l_ShowShipmentMaintenance
            End Get
            Set(ByVal value As Boolean)
                l_ShowShipmentMaintenance = value
            End Set
        End Property

        ''' <summary>Public Property used to determine if users will be shown menu items for adding/removing an OrderHeader</summary>
        ''' <returns>Boolean: If the items will appear in the menu</returns>
        Public Property ShowOrderHeaderMaintenance() As Boolean
            Get
                Return l_ShowOrderHeaderMaintenance
            End Get
            Set(ByVal value As Boolean)
                l_ShowOrderHeaderMaintenance = value
            End Set
        End Property

        ''' <summary>Public Property used to determine if users will be shown menu items for adding/removing an OrderDetail</summary>
        ''' <returns>Boolean: If the items will appear in the menu</returns>
        Public Property ShowOrderDetailMaintenance() As Boolean
            Get
                Return l_ShowOrderDetailMaintenance
            End Get
            Set(ByVal value As Boolean)
                l_ShowOrderDetailMaintenance = value
            End Set
        End Property

        ''' <summary>Determines if Business Rules will be tested in the event of any removes or deletes are issued by the context menu</summary>
        ''' <value>Boolean: If the Business Rules will be enforced</value>
        Public Property BusinessRulesOnRemove() As Boolean
            Get
                Return l_BusinessRulesOnRemove
            End Get
            Set(ByVal value As Boolean)
                l_BusinessRulesOnRemove = value
            End Set
        End Property

        ''' <summary>Determines if Business Rules will be tested in the event of any changes are issued by the context menu</summary>
        ''' <value>Boolean: If the Business Rules will be enforced</value>
        Public Property BusinessRulesOnChange() As Boolean
            Get
                Return l_BusinessRulesOnChange
            End Get
            Set(ByVal value As Boolean)
                l_BusinessRulesOnChange = value
            End Set
        End Property

        ''' <summary>Determines if Business Rules will be tested in the event of any additions issued by the context menu</summary>
        ''' <value>Boolean: If the Business Rules will be enforced</value>
        Public Property BusinessRulesOnAdd() As Boolean
            Get
                Return l_BusinessRulesOnAdd
            End Get
            Set(ByVal value As Boolean)
                l_BusinessRulesOnAdd = value
            End Set
        End Property

#End Region

#Region "Constructors"
        ''' <summary>Creates a new instance of the dbiWSFObjectMenu.</summary>
        Public Sub New()
            MyBase.New()
            'This code initializes the Timer control for use in indicating Data Updates from the Context Menu
            l_UpdateDataTimer.Enabled = False
            l_UpdateDataTimer.Interval = 1
        End Sub

        ''' <summary>Creates a new instance of the dbiWSFObjectMenu.</summary>
        Public Sub New(ByRef ParentWSFObjects As dbiWSF.FrameworkObjects.objWSFObjects)
            Me.New()
            WSFObjects = ParentWSFObjects

        End Sub
#End Region

#Region "Load Methods"
        ''' <summary>Public method used to generate the items for the Context Menu, based on the supplied object.</summary>
        ''' <param name="WSFObject"></param>
        Public Sub BuildMenu(ByVal WSFObject As Object)
            Me.Items.Clear()
            If Me.WSFObjects IsNot Nothing Then
                l_MyObject = WSFObject
                If l_MyObject IsNot Nothing Then
                    Select Case l_MyObject.GetType.ToString
                        Case GetType(dbiWSF.FrameworkObjects.objWarehouse).ToString
                            WarehouseMenu(WSFObject)
                        Case GetType(dbiWSF.FrameworkObjects.objLoadingDock).ToString
                            LoadingDockMenu(WSFObject)
                        Case GetType(dbiWSF.FrameworkObjects.objShipment).ToString
                            ShipmentMenu(WSFObject)
                        Case (GetType(dbiWSF.FrameworkObjects.objOrderHeader).ToString)
                            OrderHeaderMenu(WSFObject)
                        Case (GetType(dbiWSF.FrameworkObjects.objOrderDetail).ToString)
                            OrderDetailMenu(WSFObject)
                        Case (GetType(dbiWSF.FrameworkObjects.objLoadingDockException).ToString)
                            LoadingDockExceptionMenu(WSFObject)
                        Case (GetType(dbiWSF.FrameworkObjects.objCargoType).ToString)
                            CargoTypeMenu(WSFObject)
                        Case (GetType(dbiWSF.FrameworkObjects.objRecurrence).ToString)
                            RecurrenceMenu(WSFObject)
                        Case (GetType(dbiWSF.ControlLibrary.dbiWSFSchedule.HitTestResults).ToString)
                            HitTestMenu(WSFObject)
                    End Select
                End If
            Else
                Me.Items.Add("The WSFObjects property of the Context Menu, has not been set properly")
            End If
        End Sub
#End Region

#Region "Event Handlers"

#Region "Warehouse EventHandlers"
        Private WarehouseAddLoadingDockHandler As New System.EventHandler(AddressOf WarehouseAddLoadingDock)
        Private WarehouseDeleteHandler As New System.EventHandler(AddressOf WarehouseDelete)
        Private WarehouseDetailHandler As New System.EventHandler(AddressOf WarehouseDetail)
#End Region

#Region "LoadingDock EventHandlers"
        Private LoadingDockAddShipmentHandler As New System.EventHandler(AddressOf LoadingDockAddShipment)
        Private LoadingDockTransferToWarehouseHandler As New System.EventHandler(AddressOf LoadingDockTransferToWarehouse)
        Private LoadingDockDeleteHandler As New System.EventHandler(AddressOf LoadingDockDelete)
        Private LoadingDockCargoTypeChangeHandler As New System.EventHandler(AddressOf LoadingDockCargoTypeChange)
        Private LoadingDockCargoDetailHandler As New System.EventHandler(AddressOf LoadingDockCargoDetail)
        Private LoadingDockDetailHandler As New System.EventHandler(AddressOf LoadingDockDetail)
        Private LoadingDockAddExceptionHandler As New System.EventHandler(AddressOf LoadingDockAddExceptions)

#End Region

#Region "Shipment EventHandlers"
        Private ShipmentAddOrderHeaderHandler As New System.EventHandler(AddressOf ShipmentAddOrderHeader)
        Private ShipmentTransferToLoadingDockHandler As New System.EventHandler(AddressOf ShipmentTransferToLoadingDock)
        Private ShipmentDeleteHandler As New System.EventHandler(AddressOf ShipmentDelete)
        Private ShipmentDetailHandler As New System.EventHandler(AddressOf ShipmentDetail)
#End Region

#Region "OrderHeader EventHandlers"
        Private OrderHeaderAddOrderDetailHandler As New System.EventHandler(AddressOf OrderHeaderAddOrderDetail)
        Private OrderHeaderDeleteHandler As New System.EventHandler(AddressOf OrderHeaderDelete)
        Private OrderHeaderDetailHandler As New System.EventHandler(AddressOf OrderHeaderDetail)
#End Region

#Region "OrderHeader EventHandlers"
        Private OrderDetailCargoTypeChangeHandler As New System.EventHandler(AddressOf OrderDetailCargoTypeChange)
        Private OrderDetailDeleteHandler As New System.EventHandler(AddressOf OrderDetailDelete)
        Private OrderDetailDetailHandler As New System.EventHandler(AddressOf OrderDetailDetail)
#End Region

#Region "Cargo Type EventHandlers"
        Private CargoTypeDetailEventHandler As New System.EventHandler(AddressOf CargoTypeDetail)
#End Region

#Region "LoadingDock Exception EventHandlers"
        Private LoadingDockExceptionRemoveLoadingDockEventHandler As New System.EventHandler(AddressOf LoadingDockExceptionRemoveLoadingDock)
        Private LoadingDockExceptionAddLoadingDockEventHandler As New System.EventHandler(AddressOf LoadingDockExceptionAddLoadingDock)
        Private LoadingDockExceptionDetailEventHandler As New System.EventHandler(AddressOf LoadingDockExceptionDetail)
        Private LoadingDockExceptionAllAffectedEventHandler As New System.EventHandler(AddressOf LoadingDockExceptionAllAffected)
        Private LoadingDockExceptionAllUnAffectedEventHandler As New System.EventHandler(AddressOf LoadingDockExceptionAllUnAffected)
#End Region

#Region "RecurrenceLoadingDock Exception EventHandlers"
        Private RecurrenceLoadingDockExceptionRemoveLoadingDockEventHandler As New System.EventHandler(AddressOf RecurrenceLoadingDockExceptionRemoveLoadingDock)
        Private RecurrenceLoadingDockExceptionAddLoadingDockEventHandler As New System.EventHandler(AddressOf RecurrenceLoadingDockExceptionAddLoadingDock)
        Private RecurrenceLoadingDockExceptionDetailEventHandler As New System.EventHandler(AddressOf RecurrenceLoadingDockExceptionDetail)
        Private RecurrenceLoadingDockExceptionAllAffectedEventHandler As New System.EventHandler(AddressOf RecurrenceLoadingDockExceptionAllAffected)
        Private RecurrenceLoadingDockExceptionAllUnAffectedEventHandler As New System.EventHandler(AddressOf RecurrenceLoadingDockExceptionAllUnAffected)
#End Region


#End Region

#Region "Main object menus"
        ''' <summary>Supporting Method: Builds a warehouse context menu</summary>
        Private Sub WarehouseMenu(ByRef MyWarehouse As dbiWSF.FrameworkObjects.objWarehouse)
            'Builds a warehouse context menu
            Dim MainContextItem As System.Windows.Forms.ToolStripMenuItem
            MainContextItem = Me.Items.Add("Warehouse: " + MyWarehouse.Description)

            Dim WarehouseTagObject As New ContextTagObject

            WarehouseTagObject.MainObject = MyWarehouse
            WarehouseTagObject.MenuItemObject = MyWarehouse
            If ShowLoadingDockMaintenance Then
                MainContextItem.DropDownItems.Add("Add LoadingDock", Nothing, WarehouseAddLoadingDockHandler).Tag = WarehouseTagObject
            End If
            If ShowWarehouseMaintenance Then
                MainContextItem.DropDownItems.Add("Delete Warehouse", Nothing, WarehouseDeleteHandler).Tag = WarehouseTagObject
            End If
            MainContextItem.DropDownItems.Add("Warehouse Detail", Nothing, WarehouseDetailHandler).Tag = WarehouseTagObject

            Dim WarehouseArgs As New WSFObjectMenuCreatedArgs
            WarehouseArgs.ObjectMenu = MainContextItem
            WarehouseArgs.WSFObject = MyWarehouse
            RaiseEvent cmWarehouseMenuBuilt(Me, WarehouseArgs)
        End Sub

        ''' <summary>Supporting Method: Builds a loading dock context menu</summary>
        Private Sub LoadingDockMenu(ByRef MyLoadingDock As dbiWSF.FrameworkObjects.objLoadingDock)
            'Builds a loadingdock context menu
            Dim MainContextItem As System.Windows.Forms.ToolStripMenuItem
            MainContextItem = Me.Items.Add("LoadingDock: " + MyLoadingDock.Description)

            Dim LoadingDockTagObject As New ContextTagObject

            LoadingDockTagObject.MainObject = MyLoadingDock
            LoadingDockTagObject.MenuItemObject = MyLoadingDock

            If ShowShipmentMaintenance Then
                MainContextItem.DropDownItems.Add("Add Shipment", Nothing, LoadingDockAddShipmentHandler).Tag = LoadingDockTagObject
            End If

            If ShowLoadingDockTransfers Then
                Dim TransferDockMenuItem As System.Windows.Forms.ToolStripMenuItem
                TransferDockMenuItem = MainContextItem.DropDownItems.Add("Transfer LoadingDock To:")

                For Each warehouse As dbiWSF.FrameworkObjects.objWarehouse In WSFObjects.Warehouses
                    If warehouse.WarehouseID <> MyLoadingDock.WarehouseID Then
                        Dim WarehouseMenuItem As System.Windows.Forms.ToolStripMenuItem
                        WarehouseMenuItem = TransferDockMenuItem.DropDownItems.Add(warehouse.Description, Nothing, LoadingDockTransferToWarehouseHandler)

                        Dim WarehouseTagObject As New ContextTagObject
                        WarehouseTagObject.MainObject = MyLoadingDock
                        WarehouseTagObject.MenuItemObject = warehouse

                        WarehouseMenuItem.Tag = WarehouseTagObject

                    End If

                Next

            End If
            If ShowLoadingDockMaintenance Then
                MainContextItem.DropDownItems.Add("Delete LoadingDock", Nothing, LoadingDockDeleteHandler).Tag = LoadingDockTagObject
            End If
            Dim CargoTypesItem As System.Windows.Forms.ToolStripMenuItem
            CargoTypesItem = MainContextItem.DropDownItems.Add("Accepted Cargo Types", Nothing, LoadingDockCargoDetailHandler)
            CargoTypesItem.Tag = LoadingDockTagObject
            If ShowLoadingDockCargoTypes Then
                For Each curCargo As dbiWSF.FrameworkObjects.objCargoType In WSFObjects.CargoTypes.Values
                    Dim CargoTypeTagObject As New ContextTagObject
                    Dim CargoItem As System.Windows.Forms.ToolStripMenuItem
                    CargoItem = CargoTypesItem.DropDownItems.Add(curCargo.Description, Nothing, LoadingDockCargoTypeChangeHandler)
                    CargoItem.CheckOnClick = True
                    If MyLoadingDock.CargoTypes.Contains(curCargo.CargoID) Then
                        CargoItem.Checked = True
                    End If

                    CargoTypeTagObject.MainObject = MyLoadingDock
                    CargoTypeTagObject.MenuItemObject = curCargo

                    CargoItem.Tag = CargoTypeTagObject
                Next
            End If

            If l_MyObject.GetType.ToString = GetType(dbiWSF.ControlLibrary.dbiWSFSchedule.HitTestResults).ToString Then
                Dim ExceptionTagObject As New ContextTagObject
                ExceptionTagObject.MainObject = MyLoadingDock
                ExceptionTagObject.MenuItemObject = WSFLoadingDockAddExceptionsArgs.ExceptionType.LoadingDockException

                Dim RecurrenceTagObject As New ContextTagObject
                RecurrenceTagObject.MainObject = MyLoadingDock
                RecurrenceTagObject.MenuItemObject = WSFLoadingDockAddExceptionsArgs.ExceptionType.LoadingDockRecurrence

                MainContextItem.DropDownItems.Add("Add Loading Dock Exception", Nothing, LoadingDockAddExceptionHandler).Tag = ExceptionTagObject

                MainContextItem.DropDownItems.Add("Add Recurring Loading Dock Exception", Nothing, LoadingDockAddExceptionHandler).Tag = RecurrenceTagObject
            End If


            MainContextItem.DropDownItems.Add("LoadingDock Detail", Nothing, LoadingDockDetailHandler).Tag = LoadingDockTagObject

            Dim LoadingDockArgs As New WSFObjectMenuCreatedArgs
            LoadingDockArgs.ObjectMenu = MainContextItem
            LoadingDockArgs.WSFObject = MyLoadingDock
            RaiseEvent cmLoadingDockMenuBuilt(Me, LoadingDockArgs)
        End Sub

        ''' <summary>Supporting Method: Builds a shipment context menu</summary>
        Private Sub ShipmentMenu(ByRef MyShipment As dbiWSF.FrameworkObjects.objShipment)
            'Builds a shipment context menu
            Dim MainContextItem As System.Windows.Forms.ToolStripMenuItem
            MainContextItem = Me.Items.Add("Shipment: " + MyShipment.Description)

            Dim ShipmentTagObject As New ContextTagObject

            ShipmentTagObject.MainObject = MyShipment
            ShipmentTagObject.MenuItemObject = MyShipment

            If ShowOrderHeaderMaintenance Then
                MainContextItem.DropDownItems.Add("Add Order Header", Nothing, ShipmentAddOrderHeaderHandler).Tag = ShipmentTagObject
            End If

            If ShowShipmentTransfers Then
                Dim TransferDockMenuItem As System.Windows.Forms.ToolStripMenuItem
                TransferDockMenuItem = MainContextItem.DropDownItems.Add("Transfer Shipment To:")

                For Each warehouse As dbiWSF.FrameworkObjects.objWarehouse In WSFObjects.Warehouses
                    Dim WarehouseMenuItem As System.Windows.Forms.ToolStripMenuItem
                    WarehouseMenuItem = TransferDockMenuItem.DropDownItems.Add(warehouse.Description)

                    For Each LoadingDock As dbiWSF.FrameworkObjects.objLoadingDock In warehouse.LoadingDocks
                        If LoadingDock.LoadingDockID <> MyShipment.LoadingDockID Then
                            Dim LoadingDockMenuItem As System.Windows.Forms.ToolStripMenuItem
                            LoadingDockMenuItem = WarehouseMenuItem.DropDownItems.Add(LoadingDock.Description, Nothing, ShipmentTransferToLoadingDockHandler)
                            Dim TransferDockTag As New ContextTagObject
                            TransferDockTag.MainObject = MyShipment
                            TransferDockTag.MenuItemObject = LoadingDock
                            LoadingDockMenuItem.Tag = TransferDockTag

                        End If
                    Next

                Next
            End If

            If ShowShipmentMaintenance Then
                MainContextItem.DropDownItems.Add("Delete Shipment", Nothing, ShipmentDeleteHandler).Tag = ShipmentTagObject
            End If
            MainContextItem.DropDownItems.Add("Shipment Detail", Nothing, ShipmentDetailHandler).Tag = ShipmentTagObject


            Dim ShipmentArgs As New WSFObjectMenuCreatedArgs
            ShipmentArgs.ObjectMenu = MainContextItem
            ShipmentArgs.WSFObject = MyShipment
            RaiseEvent cmShipmentMenuBuilt(Me, ShipmentArgs)

        End Sub

        ''' <summary>Supporting Method: Builds an OrderHeader context menu</summary>
        Private Sub OrderHeaderMenu(ByRef MyOrderHeader As dbiWSF.FrameworkObjects.objOrderHeader)
            'Builds a order header context menu
            Dim MainContextItem As System.Windows.Forms.ToolStripMenuItem
            MainContextItem = Me.Items.Add("Order Header: " + MyOrderHeader.OrderEntryID)

            Dim OrderHeaderTagObject As New ContextTagObject

            OrderHeaderTagObject.MainObject = MyOrderHeader
            OrderHeaderTagObject.MenuItemObject = MyOrderHeader

            If ShowOrderDetailMaintenance Then
                MainContextItem.DropDownItems.Add("Add Order Detail", Nothing, OrderHeaderAddOrderDetailHandler).Tag = OrderHeaderTagObject
            End If
            If ShowOrderHeaderMaintenance Then
                MainContextItem.DropDownItems.Add("Delete Order Header", Nothing, OrderHeaderDeleteHandler).Tag = OrderHeaderTagObject
            End If
            MainContextItem.DropDownItems.Add("Order Header Detail", Nothing, OrderHeaderDetailHandler).Tag = OrderHeaderTagObject

            Dim OrderHeaderArgs As New WSFObjectMenuCreatedArgs
            OrderHeaderArgs.ObjectMenu = MainContextItem
            OrderHeaderArgs.WSFObject = MyOrderHeader
            RaiseEvent cmOrderHeaderMenuBuilt(Me, OrderHeaderArgs)
        End Sub

        ''' <summary>Supporting Method: Builds an OrderDetail context menu</summary>
        Private Sub OrderDetailMenu(ByRef MyOrderDetail As dbiWSF.FrameworkObjects.objOrderDetail)
            'Build an Order Detail context menu
            Dim MainContextItem As System.Windows.Forms.ToolStripMenuItem
            MainContextItem = Me.Items.Add("Order Detail: " + MyOrderDetail.LineNumber.ToString)

            Dim OrderDetailTagObject As New ContextTagObject

            OrderDetailTagObject.MainObject = MyOrderDetail
            OrderDetailTagObject.MenuItemObject = MyOrderDetail

            If ShowOrderDetailMaintenance Then
                MainContextItem.DropDownItems.Add("Delete Order Detail").Tag = OrderDetailTagObject
            End If

            Dim CargoStripItem As System.Windows.Forms.ToolStripMenuItem
            CargoStripItem = MainContextItem.DropDownItems.Add("Cargo Type")

            Dim CargoValuesItem As New System.Windows.Forms.ToolStripComboBox
            CargoStripItem.DropDownItems.Add(CargoValuesItem)

            For Each curCargo As dbiWSF.FrameworkObjects.objCargoType In WSFObjects.CargoTypes.Values
                CargoValuesItem.ComboBox.Items.Add(curCargo.Description)
            Next

            CargoValuesItem.ComboBox.SelectedItem = WSFObjects.GetCargoFromGUID(MyOrderDetail.CargoTypeID).Description
            AddHandler CargoValuesItem.ComboBox.SelectedIndexChanged, OrderDetailCargoTypeChangeHandler

            MainContextItem.DropDownItems.Add("Order Detail Detail").Tag = OrderDetailTagObject

            Dim OrderDetailArgs As New WSFObjectMenuCreatedArgs
            OrderDetailArgs.ObjectMenu = MainContextItem
            OrderDetailArgs.WSFObject = MyOrderDetail
            RaiseEvent cmOrderDetailMenuBuilt(Me, OrderDetailArgs)
        End Sub
#End Region

#Region "Supporting Objects"
        ''' <summary>Supporting Method: Builds a CargoType context menu</summary>
        Private Sub CargoTypeMenu(ByRef MyCargoType As dbiWSF.FrameworkObjects.objCargoType)
            Dim MainContextItem As System.Windows.Forms.ToolStripMenuItem
            MainContextItem = Me.Items.Add("Cargo Type: " + MyCargoType.Description)

            Dim CargoTypeTagObject As New ContextTagObject

            CargoTypeTagObject.MainObject = MyCargoType
            CargoTypeTagObject.MenuItemObject = MyCargoType

            MainContextItem.DropDownItems.Add("Cargo Type Detail", Nothing, CargoTypeDetailEventHandler).Tag = CargoTypeTagObject

            Dim CargoTypeArgs As New WSFObjectMenuCreatedArgs
            CargoTypeArgs.ObjectMenu = MainContextItem
            CargoTypeArgs.WSFObject = MyCargoType
            RaiseEvent cmCargoTypeMenuBuilt(Me, CargoTypeArgs)
        End Sub

        ''' <summary>Supporting Method: Builds a LoadingDockException context menu</summary>
        Private Sub LoadingDockExceptionMenu(ByRef MyLoadingDockException As dbiWSF.FrameworkObjects.objLoadingDockException)
            Dim MainContextItem As System.Windows.Forms.ToolStripMenuItem
            MainContextItem = Me.Items.Add("Loading Dock Exception: " + MyLoadingDockException.Description)

            Dim LoadingDockExceptionTagObject As New ContextTagObject

            LoadingDockExceptionTagObject.MainObject = MyLoadingDockException
            LoadingDockExceptionTagObject.MenuItemObject = MyLoadingDockException

            Dim AllAffectedDocks As System.Windows.Forms.ToolStripMenuItem
            AllAffectedDocks = MainContextItem.DropDownItems.Add("Remove Affected Loading Dock", Nothing, LoadingDockExceptionAllAffectedEventHandler)
            AllAffectedDocks.Tag = LoadingDockExceptionTagObject

            Dim AllUnAffectedDocks As System.Windows.Forms.ToolStripMenuItem
            AllUnAffectedDocks = MainContextItem.DropDownItems.Add("Add UnAffected Loading Dock", Nothing, LoadingDockExceptionAllUnAffectedEventHandler)
            AllUnAffectedDocks.Tag = LoadingDockExceptionTagObject


            For Each Warehouse As dbiWSF.FrameworkObjects.objWarehouse In WSFObjects.Warehouses
                Dim AffectedWarehouseMenuItem As New System.Windows.Forms.ToolStripMenuItem
                AffectedWarehouseMenuItem = AllAffectedDocks.DropDownItems.Add(Warehouse.Description)

                Dim UnAffectedWarehouseMenuItem As New System.Windows.Forms.ToolStripMenuItem
                UnAffectedWarehouseMenuItem = AllUnAffectedDocks.DropDownItems.Add(Warehouse.Description)

                Dim LoadingDockMenuItem As System.Windows.Forms.ToolStripMenuItem

                For Each LoadingDock As dbiWSF.FrameworkObjects.objLoadingDock In Warehouse.LoadingDocks
                    Dim DockExceptionTag As New ContextTagObject
                    DockExceptionTag.MainObject = MyLoadingDockException
                    DockExceptionTag.MenuItemObject = LoadingDock
                    If MyLoadingDockException.LoadingDocks.Contains(LoadingDock.LoadingDockID) Then
                        LoadingDockMenuItem = AffectedWarehouseMenuItem.DropDownItems.Add(LoadingDock.Description, Nothing, LoadingDockExceptionRemoveLoadingDockEventHandler)
                        LoadingDockMenuItem.Tag = LoadingDock
                        l_AffectedLoadingDocks.Add(LoadingDock)
                    Else
                        LoadingDockMenuItem = UnAffectedWarehouseMenuItem.DropDownItems.Add(LoadingDock.Description, Nothing, LoadingDockExceptionAddLoadingDockEventHandler)
                        LoadingDockMenuItem.Tag = LoadingDock
                        l_UnAffectedLoadingDocks.Add(LoadingDock)
                    End If
                    LoadingDockMenuItem.Tag = DockExceptionTag
                Next

                If AffectedWarehouseMenuItem.DropDownItems.Count < 1 Or ShowLoadingDockExceptionAffectedMenu = False Then
                    AllAffectedDocks.DropDownItems.Remove(AffectedWarehouseMenuItem)
                End If
                If UnAffectedWarehouseMenuItem.DropDownItems.Count < 1 Or ShowLoadingDockExceptionUnAffectedMenu = False Then
                    AllUnAffectedDocks.DropDownItems.Remove(UnAffectedWarehouseMenuItem)
                End If
            Next


            MainContextItem.DropDownItems.Add("LoadingDockException Detail", Nothing, LoadingDockExceptionDetailEventHandler).Tag = LoadingDockExceptionTagObject

            Dim LoadingDockExceptionArgs As New WSFObjectMenuCreatedArgs
            LoadingDockExceptionArgs.ObjectMenu = MainContextItem
            LoadingDockExceptionArgs.WSFObject = MyLoadingDockException
            RaiseEvent cmLoadingDockExceptionMenuBuilt(Me, LoadingDockExceptionArgs)
        End Sub

        ''' <summary>Supporting Method: Builds a RecurringLoadingDockException context menu</summary>
        Private Sub RecurrenceMenu(ByRef MyRecurrence As dbiWSF.FrameworkObjects.objRecurrence)
            Dim MainContextItem As System.Windows.Forms.ToolStripMenuItem
            MainContextItem = Me.Items.Add("Recurring Loading Dock Exception: " + MyRecurrence.Description)

            Dim RecurrenceTagObject As New ContextTagObject

            RecurrenceTagObject.MainObject = MyRecurrence
            RecurrenceTagObject.MenuItemObject = MyRecurrence

            Dim AllAffectedDocks As System.Windows.Forms.ToolStripMenuItem
            AllAffectedDocks = MainContextItem.DropDownItems.Add("Remove Affected Loading Dock", Nothing, RecurrenceLoadingDockExceptionAllAffectedEventHandler)
            AllAffectedDocks.Tag = RecurrenceTagObject

            Dim AllUnAffectedDocks As System.Windows.Forms.ToolStripMenuItem
            AllUnAffectedDocks = MainContextItem.DropDownItems.Add("Add UnAffected Loading Dock", Nothing, RecurrenceLoadingDockExceptionAllUnAffectedEventHandler)
            AllUnAffectedDocks.Tag = RecurrenceTagObject

            For Each Warehouse As dbiWSF.FrameworkObjects.objWarehouse In WSFObjects.Warehouses
                Dim AffectedWarehouseMenuItem As New System.Windows.Forms.ToolStripMenuItem
                AffectedWarehouseMenuItem = AllAffectedDocks.DropDownItems.Add(Warehouse.Description)

                Dim UnAffectedWarehouseMenuItem As New System.Windows.Forms.ToolStripMenuItem
                UnAffectedWarehouseMenuItem = AllUnAffectedDocks.DropDownItems.Add(Warehouse.Description)

                Dim LoadingDockMenuItem As System.Windows.Forms.ToolStripMenuItem

                For Each LoadingDock As dbiWSF.FrameworkObjects.objLoadingDock In Warehouse.LoadingDocks
                    Dim RecurrenceTag As New ContextTagObject
                    RecurrenceTag.MainObject = MyRecurrence
                    RecurrenceTag.MenuItemObject = LoadingDock
                    If MyRecurrence.RecurringObjects.Contains(LoadingDock.LoadingDockID) Then
                        LoadingDockMenuItem = AffectedWarehouseMenuItem.DropDownItems.Add(LoadingDock.Description, Nothing, RecurrenceLoadingDockExceptionRemoveLoadingDockEventHandler)
                        LoadingDockMenuItem.Tag = LoadingDock
                        l_AffectedLoadingDocks.Add(LoadingDock)
                    Else
                        LoadingDockMenuItem = UnAffectedWarehouseMenuItem.DropDownItems.Add(LoadingDock.Description, Nothing, RecurrenceLoadingDockExceptionAddLoadingDockEventHandler)
                        LoadingDockMenuItem.Tag = LoadingDock
                        l_UnAffectedLoadingDocks.Add(LoadingDock)
                    End If
                    LoadingDockMenuItem.Tag = RecurrenceTag
                Next

                If AffectedWarehouseMenuItem.DropDownItems.Count < 1 Or ShowRecurrenceLoadingDockExceptionAffectedMenu = False Then
                    AllAffectedDocks.DropDownItems.Remove(AffectedWarehouseMenuItem)
                End If
                If UnAffectedWarehouseMenuItem.DropDownItems.Count < 1 Or ShowRecurrenceLoadingDockExceptionUnAffectedMenu = False Then
                    AllUnAffectedDocks.DropDownItems.Remove(UnAffectedWarehouseMenuItem)
                End If
            Next


            MainContextItem.DropDownItems.Add("RecurrenceLoadingDockException Detail", Nothing, RecurrenceLoadingDockExceptionDetailEventHandler).Tag = RecurrenceTagObject

            Dim RecurrenceArgs As New WSFObjectMenuCreatedArgs
            RecurrenceArgs.ObjectMenu = MainContextItem
            RecurrenceArgs.WSFObject = MyRecurrence
            RaiseEvent cmRecurrenceLoadingDockExceptionMenuBuilt(Me, RecurrenceArgs)
        End Sub

#End Region

#Region "HitTest"
        ''' <summary>Supporting Method: Creates a context menu using a dbiWSFSchedule.HitTest object.</summary>
        Private Sub HitTestMenu(ByRef MyHitTestResults As dbiWSF.ControlLibrary.dbiWSFSchedule.HitTestResults)
            If MyHitTestResults.ScheduleItem IsNot Nothing Then
                If GetType(dbiWSF.FrameworkObjects.objWarehouse).ToString = MyHitTestResults.ScheduleItem.Tag.GetType.ToString Then
                    WarehouseMenu(MyHitTestResults.ScheduleItem.Tag)
                Else
                    LoadingDockMenu(MyHitTestResults.ScheduleItem.Tag)
                End If
                Dim Divide As New System.Windows.Forms.ToolStripSeparator
                Me.Items.Add(Divide)
            End If

            For Each curTimeBar As Dbi.WinControl.Schedule.dbiTimeBarItem In MyHitTestResults.TimeBarItems
                ShipmentMenu(curTimeBar.Tag)
                Dim Divide As New System.Windows.Forms.ToolStripSeparator
                Me.Items.Add(Divide)
            Next

            For Each curCustomArea As Dbi.PIM.dbiCustomArea In MyHitTestResults.CustomAreas


                Select Case curCustomArea.Tag.GetType.ToString
                    Case (GetType(dbiWSF.FrameworkObjects.objLoadingDockException).ToString)
                        LoadingDockExceptionMenu(curCustomArea.Tag)
                    Case (GetType(dbiWSF.FrameworkObjects.objRecurrence).ToString)
                        RecurrenceMenu(curCustomArea.Tag)
                End Select
                Dim Divide As New System.Windows.Forms.ToolStripSeparator
                Me.Items.Add(Divide)
            Next

            If Me.Items.Count > 0 Then
                Me.Items.RemoveAt(Me.Items.Count - 1)
            End If

        End Sub
#End Region

#Region "private Events"

#Region "Warehouse Events"
        ''' <summary>Supporting Method: The methods attached to the menu items.</summary>
        Private Sub WarehouseAddLoadingDock(ByVal sender As System.Object, ByVal e As System.EventArgs)
            Dim WarehouseArgs As New WSFObjectAddArgs

            WarehouseArgs.argsWarehouse = sender.tag.MainObject

            WarehouseArgs.argsWSFObject = WSFObjects

            RaiseEvent cmWarehouseAddLoadingDockClicked(sender, WarehouseArgs)

        End Sub

        ''' <summary>Supporting Method: The methods attached to the menu items.</summary>
        Private Sub WarehouseDelete(ByVal sender As System.Object, ByVal e As System.EventArgs)
            Dim WarehouseArgs As New WSFObjectDeleteArgs
            WarehouseArgs.argsWarehouseToDelete = sender.tag.MainObject
            WarehouseArgs.argsWSFObject = WSFObjects

            RaiseEvent cmWarehouseDeleteClicked(sender, WarehouseArgs)

            If WarehouseArgs.AllowDelete Then
                If Me.BusinessRulesOnRemove Then
                    g_EventArg = WarehouseArgs
                    g_EventArgMethod = Dialogs.EventMethods.ObjectMenu_WarehouseDelete
                    Me.timerEventSynch.Enabled = True
                Else
                    WarehouseArgs.argsWarehouseToDelete.Remove()
                    l_UpdateDataTimer.Enabled = True
                End If
            End If

        End Sub

        ''' <summary>Supporting Method: The methods attached to the menu items.</summary>
        Private Sub WarehouseDetail(ByVal sender As System.Object, ByVal e As System.EventArgs)
            Dim WarehouseArgs As New WSFObjectViewDetailArgs
            WarehouseArgs.argsWarehouseToView = sender.tag.MainObject
            WarehouseArgs.argsWSFObject = WSFObjects
            WarehouseArgs.argsObject = sender.tag.MainObject

            RaiseEvent cmWarehouseDetailClicked(sender, WarehouseArgs)
            RaiseEvent cmDetailClicked(sender, WarehouseArgs)

        End Sub
#End Region

#Region "LoadingDock Events"
        ''' <summary>Supporting Method: The methods attached to the menu items.</summary>
        Private Sub LoadingDockAddShipment(ByVal sender As System.Object, ByVal e As System.EventArgs)
            Dim LoadingDockArgs As New WSFObjectAddArgs

            LoadingDockArgs.argsLoadingDock = sender.tag.MainObject

            LoadingDockArgs.argsWSFObject = WSFObjects
            RaiseEvent cmLoadingDockAddShipmentClicked(sender, LoadingDockArgs)

        End Sub

        ''' <summary>Supporting Method: The methods attached to the menu items.</summary>
        Private Sub LoadingDockTransferToWarehouse(ByVal sender As System.Object, ByVal e As System.EventArgs)
            Dim LoadingDockArgs As New WSFObjectTransferEventArgs
            LoadingDockArgs.argsLoadingDock = sender.tag.MainObject
            LoadingDockArgs.argsWarehouseTo = sender.tag.MenuItemObject
            LoadingDockArgs.argsWarehouseFrom = WSFObjects.GetWarehouseFromGUID(LoadingDockArgs.argsLoadingDock.WarehouseID)
            LoadingDockArgs.argsWSFObject = WSFObjects

            LoadingDockArgs.argsLoadingDock.WarehouseID = LoadingDockArgs.argsWarehouseTo.WarehouseID
            RaiseEvent cmLoadingDockTransferToWarehouseClicked(sender, LoadingDockArgs)

            If LoadingDockArgs.AllowTransfer Then
                If BusinessRulesOnChange Then
                    g_EventArg = LoadingDockArgs
                    g_EventArgMethod = Dialogs.EventMethods.ObjectMenu_LoadingDockTransferToWarehouse
                    Me.timerEventSynch.Enabled = True
                Else
                    l_UpdateDataTimer.Enabled = True
                End If
            Else
                LoadingDockArgs.argsLoadingDock.WarehouseID = LoadingDockArgs.argsWarehouseFrom.WarehouseID
            End If

        End Sub

        ''' <summary>Supporting Method: The methods attached to the menu items.</summary>
        Private Sub LoadingDockDelete(ByVal sender As System.Object, ByVal e As System.EventArgs)
            Dim LoadingDockArgs As New WSFObjectDeleteArgs
            LoadingDockArgs.argsLoadingDockToDelete = sender.tag.MainObject
            LoadingDockArgs.argsWSFObject = WSFObjects

            RaiseEvent cmLoadingDockDeleteClicked(sender, LoadingDockArgs)

            If LoadingDockArgs.AllowDelete Then
                If Me.BusinessRulesOnRemove Then
                    g_EventArg = LoadingDockArgs
                    g_EventArgMethod = Dialogs.EventMethods.ObjectMenu_LoadingDockDelete
                    Me.timerEventSynch.Enabled = True
                Else
                    LoadingDockArgs.argsLoadingDockToDelete.Remove(Me.l_MyWSFObjects.GetWarehouseFromGUID(LoadingDockArgs.argsLoadingDockToDelete.WarehouseID))
                    l_UpdateDataTimer.Enabled = True
                End If
            End If
        End Sub

        ''' <summary>Supporting Method: The methods attached to the menu items.</summary>
        Private Sub LoadingDockCargoTypeChange(ByVal sender As System.Object, ByVal e As System.EventArgs)
            Dim LoadingDockArgs As New WSFLoadingDockCargoChangeArgs
            LoadingDockArgs.argsCargoType = sender.tag.MenuItemObject
            LoadingDockArgs.argsLoadingDock = sender.tag.MainObject
            LoadingDockArgs.argsWSFObject = WSFObjects

            If LoadingDockArgs.argsLoadingDock.CargoTypes.Contains(LoadingDockArgs.argsCargoType.CargoID) Then
                LoadingDockArgs.argsChangeStatus = WSFLoadingDockCargoChangeArgs.CargoChangeStatus.ToRemove
                LoadingDockArgs.argsLoadingDock.RemoveCargoType(LoadingDockArgs.argsCargoType.CargoID)
            Else
                LoadingDockArgs.argsChangeStatus = WSFLoadingDockCargoChangeArgs.CargoChangeStatus.toAdd
                LoadingDockArgs.argsLoadingDock.AddCargoType(LoadingDockArgs.argsCargoType.CargoID)
            End If

            RaiseEvent cmLoadingDockCargoTypeChangeClicked(sender, LoadingDockArgs)

            If LoadingDockArgs.AllowChange Then
                If BusinessRulesOnChange Then
                    g_EventArg = LoadingDockArgs
                    g_EventArgMethod = Dialogs.EventMethods.ObjectMenu_LoadingDockCargoTypeChange
                    Me.timerEventSynch.Enabled = True
                Else
                    l_UpdateDataTimer.Enabled = True
                End If


            Else
                If LoadingDockArgs.argsChangeStatus = WSFLoadingDockCargoChangeArgs.CargoChangeStatus.toAdd Then
                    LoadingDockArgs.argsLoadingDock.RemoveCargoType(LoadingDockArgs.argsCargoType.CargoID)
                Else
                    LoadingDockArgs.argsLoadingDock.AddCargoType(LoadingDockArgs.argsCargoType.CargoID)
                End If
            End If


        End Sub

        ''' <summary>Supporting Method: The methods attached to the menu items.</summary>
        Private Sub LoadingDockCargoDetail(ByVal sender As System.Object, ByVal e As System.EventArgs)
            Dim LoadingDockArgs As New WSFLoadingDockCargoDetailArgs
            LoadingDockArgs.argsLoadingDock = sender.tag.MainObject
            LoadingDockArgs.argsWSFObject = WSFObjects

            For Each curCargo As dbiWSF.FrameworkObjects.objCargoType In LoadingDockArgs.argsWSFObject.CargoTypes.Values
                If LoadingDockArgs.argsLoadingDock.CargoTypes.Contains(curCargo.CargoID) Then
                    LoadingDockArgs.argsAcceptedCargos.Add(curCargo)
                Else
                    LoadingDockArgs.argsUnAcceptedCargos.Add(curCargo)
                End If
            Next

            RaiseEvent cmLoadingDockCargoDetailClicked(sender, LoadingDockArgs)

        End Sub

        ''' <summary>Supporting Method: The methods attached to the menu items.</summary>
        Private Sub LoadingDockDetail(ByVal sender As System.Object, ByVal e As System.EventArgs)
            Dim LoadingDockArgs As New WSFObjectViewDetailArgs
            LoadingDockArgs.argsLoadingDockToView = sender.tag.MainObject
            LoadingDockArgs.argsObject = sender.tag.MainObject
            LoadingDockArgs.argsWSFObject = WSFObjects

            RaiseEvent cmLoadingDockDetailClicked(sender, LoadingDockArgs)
            RaiseEvent cmDetailClicked(sender, LoadingDockArgs)

        End Sub

        ''' <summary>Supporting Method: The methods attached to the menu items.</summary>
        Private Sub LoadingDockAddExceptions(ByVal sender As System.Object, ByVal e As System.EventArgs)
            Dim LoadingDockAddExceptionsArgs As New WSFLoadingDockAddExceptionsArgs

            LoadingDockAddExceptionsArgs.argsLoadingDock = sender.tag.MainObject
            LoadingDockAddExceptionsArgs.argsDateTimeAt = l_MyObject.DateTimeAt
            LoadingDockAddExceptionsArgs.argsWSFObject = WSFObjects
            LoadingDockAddExceptionsArgs.argsExceptionType = sender.tag.MenuItemObject

            RaiseEvent cmLoadingDockAddExceptionClicked(sender, LoadingDockAddExceptionsArgs)
            RaiseEvent cmUpdatedData(sender, e)
        End Sub
#End Region

#Region "Shipment Events"
        ''' <summary>Supporting Method: The methods attached to the menu items.</summary>
        Private Sub ShipmentTransferToLoadingDock(ByVal sender As System.Object, ByVal e As System.EventArgs)
            Dim ShipmentArgs As New WSFObjectTransferEventArgs
            ShipmentArgs.argsShipment = sender.tag.MainObject
            ShipmentArgs.argsLoadingDockTo = WSFObjects.GetLoadingDockFromGUID(sender.tag.MenuItemObject.LoadingDockID)
            ShipmentArgs.argsLoadingDockFrom = WSFObjects.GetLoadingDockFromGUID(ShipmentArgs.argsShipment.LoadingDockID)
            ShipmentArgs.argsWarehouseTo = WSFObjects.GetWarehouseFromGUID(ShipmentArgs.argsLoadingDockTo.WarehouseID)
            ShipmentArgs.argsWarehouseFrom = WSFObjects.GetWarehouseFromGUID(ShipmentArgs.argsLoadingDockFrom.WarehouseID)
            ShipmentArgs.argsWSFObject = WSFObjects

            ShipmentArgs.argsShipment.LoadingDockID = ShipmentArgs.argsLoadingDockTo.LoadingDockID

            RaiseEvent cmShipmentTransferToLoadingDockClicked(sender, ShipmentArgs)

            If ShipmentArgs.AllowTransfer Then
                If BusinessRulesOnChange Then
                    g_EventArg = ShipmentArgs
                    g_EventArgMethod = Dialogs.EventMethods.ObjectMenu_ShipmentTransferToLoadingDock
                    Me.timerEventSynch.Enabled = True
                Else
                    l_UpdateDataTimer.Enabled = True
                End If
            Else
                ShipmentArgs.argsShipment.LoadingDockID = ShipmentArgs.argsLoadingDockFrom.LoadingDockID
            End If

        End Sub

        ''' <summary>Supporting Method: The methods attached to the menu items.</summary>
        Private Sub ShipmentAddOrderHeader(ByVal sender As System.Object, ByVal e As System.EventArgs)
            Dim e2 As New WSFObjectAddArgs
            e2.argsShipment = sender.tag.MainObject
            e2.argsWSFObject = WSFObjects

            RaiseEvent cmShipmentAddOrderHeaderClicked(sender, e2)


        End Sub

        ''' <summary>Supporting Method: The methods attached to the menu items.</summary>
        Private Sub ShipmentDelete(ByVal sender As System.Object, ByVal e As System.EventArgs)
            Dim ShipmentArgs As New WSFObjectDeleteArgs
            ShipmentArgs.argsShipmentToDelete = sender.tag.MainObject
            ShipmentArgs.argsWSFObject = WSFObjects

            RaiseEvent cmShipmentDeleteClicked(sender, ShipmentArgs)

            If ShipmentArgs.AllowDelete Then
                If Me.BusinessRulesOnRemove Then
                    g_EventArg = ShipmentArgs
                    g_EventArgMethod = Dialogs.EventMethods.ObjectMenu_ShipmentDelete
                    Me.timerEventSynch.Enabled = True
                Else
                    ShipmentArgs.argsShipmentToDelete.Remove(ShipmentArgs.argsWSFObject.GetLoadingDockFromGUID(ShipmentArgs.argsShipmentToDelete.LoadingDockID))
                    l_UpdateDataTimer.Enabled = True
                End If
            End If


        End Sub

        ''' <summary>Supporting Method: The methods attached to the menu items.</summary>
        Private Sub ShipmentDetail(ByVal sender As System.Object, ByVal e As System.EventArgs)
            Dim ShipmentArgs As New WSFObjectViewDetailArgs
            ShipmentArgs.argsShipmentToView = sender.tag.MainObject
            ShipmentArgs.argsObject = sender.tag.MainObject
            ShipmentArgs.argsWSFObject = WSFObjects

            RaiseEvent cmShipmentDetailClicked(sender, ShipmentArgs)
            RaiseEvent cmDetailClicked(sender, ShipmentArgs)


        End Sub
#End Region

#Region "OrderHeader Events"
        ''' <summary>Supporting Method: The methods attached to the menu items.</summary>
        Private Sub OrderHeaderAddOrderDetail(ByVal sender As System.Object, ByVal e As System.EventArgs)
            Dim OrderHeaderArgs As New WSFObjectAddArgs
            OrderHeaderArgs.argsOrderHeader = sender.tag.MainObject
            OrderHeaderArgs.argsWSFObject = WSFObjects

            RaiseEvent cmOrderHeaderAddOrderDetailClicked(sender, OrderHeaderArgs)


        End Sub

        ''' <summary>Supporting Method: The methods attached to the menu items.</summary>
        Private Sub OrderHeaderDelete(ByVal sender As System.Object, ByVal e As System.EventArgs)
            Dim OrderHeaderArgs As New WSFObjectDeleteArgs
            OrderHeaderArgs.argsOrderHeaderToDelete = sender.tag.MainObject
            OrderHeaderArgs.argsWSFObject = WSFObjects

            RaiseEvent cmOrderHeaderDeleteClicked(sender, OrderHeaderArgs)

            If OrderHeaderArgs.AllowDelete Then
                If Me.BusinessRulesOnRemove Then
                    g_EventArg = OrderHeaderArgs
                    g_EventArgMethod = Dialogs.EventMethods.ObjectMenu_OrderHeaderDelete
                    Me.timerEventSynch.Enabled = True
                Else
                    OrderHeaderArgs.argsWarehouseToDelete.Remove()
                    l_UpdateDataTimer.Enabled = True
                End If
            End If


        End Sub

        ''' <summary>Supporting Method: The methods attached to the menu items.</summary>
        Private Sub OrderHeaderDetail(ByVal sender As System.Object, ByVal e As System.EventArgs)
            Dim OrderHeaderArgs As New WSFObjectViewDetailArgs
            OrderHeaderArgs.argsOrderHeaderToView = sender.tag.MainObject
            OrderHeaderArgs.argsObject = sender.tag.MainObject
            OrderHeaderArgs.argsWSFObject = WSFObjects

            RaiseEvent cmOrderHeaderDetailClicked(sender, OrderHeaderArgs)
            RaiseEvent cmDetailClicked(sender, OrderHeaderArgs)


        End Sub
#End Region

#Region "OrderDetail Events"
        ''' <summary>Supporting Method: The methods attached to the menu items.</summary>
        Private Sub OrderDetailCargoTypeChange(ByVal sender As System.Object, ByVal e As System.EventArgs)
            Dim OrderDetailArgs As New WSFOrderDetailCargoChangeArgs
            OrderDetailArgs.argsOrderDetail = sender.tag.MainObject
            OrderDetailArgs.argsOldCargoType = WSFObjects.GetCargoFromGUID(sender.tag.MainObject.cargotypeid)
            For Each curCargo As dbiWSF.FrameworkObjects.objCargoType In WSFObjects.CargoTypes.Values
                If curCargo.Description = sender.selecteditem Then
                    OrderDetailArgs.argsNewCargoType = curCargo
                    Exit For
                End If
            Next

            OrderDetailArgs.argsOrderDetail.CargoTypeID = OrderDetailArgs.argsNewCargoType.CargoID

            OrderDetailArgs.argsWSFObject = WSFObjects

            RaiseEvent cmOrderDetailCargoTypeChanged(sender, OrderDetailArgs)

            If OrderDetailArgs.AllowChange Then
                If BusinessRulesOnChange Then
                    g_EventArg = OrderDetailArgs
                    g_EventArgMethod = Dialogs.EventMethods.ObjectMenu_OrderDetailCargoTypeChange
                    Me.timerEventSynch.Enabled = True
                End If
            Else
                OrderDetailArgs.argsOrderDetail.CargoTypeID = OrderDetailArgs.argsOldCargoType.CargoID
            End If


        End Sub

        ''' <summary>Supporting Method: The methods attached to the menu items.</summary>
        Private Sub OrderDetailDelete(ByVal sender As System.Object, ByVal e As System.EventArgs)
            Dim OrderDetailArgs As New WSFObjectDeleteArgs
            OrderDetailArgs.argsOrderDetailToDelete = sender.tag.MainObject
            OrderDetailArgs.argsWSFObject = WSFObjects

            RaiseEvent cmOrderDetailDeleteClicked(sender, OrderDetailArgs)

            If OrderDetailArgs.AllowDelete Then
                If Me.BusinessRulesOnRemove Then
                    g_EventArg = OrderDetailArgs
                    g_EventArgMethod = Dialogs.EventMethods.ObjectMenu_OrderDetailDelete
                    Me.timerEventSynch.Enabled = True
                Else
                    OrderDetailArgs.argsOrderDetailToDelete.Remove(OrderDetailArgs.argsWSFObject.GetOrderHeaderFromGUID(OrderDetailArgs.argsOrderDetailToDelete.OrderID))
                    l_UpdateDataTimer.Enabled = True
                End If
            End If

        End Sub

        ''' <summary>Supporting Method: The methods attached to the menu items.</summary>
        Private Sub OrderDetailDetail(ByVal sender As System.Object, ByVal e As System.EventArgs)
            Dim OrderDetailArgs As New WSFObjectViewDetailArgs
            OrderDetailArgs.argsOrderDetailToView = sender.tag.MainObject
            OrderDetailArgs.argsObject = sender.tag.MainObject
            OrderDetailArgs.argsWSFObject = WSFObjects

            RaiseEvent cmOrderDetailDetailClicked(sender, OrderDetailArgs)
            RaiseEvent cmDetailClicked(sender, OrderDetailArgs)


        End Sub
#End Region

#Region "Cargo Type Events"
        ''' <summary>Supporting Method: The methods attached to the menu items.</summary>
        Private Sub CargoTypeDetail(ByVal sender As System.Object, ByVal e As System.EventArgs)
            Dim CargoArgs As New WSFObjectViewDetailArgs
            CargoArgs.argsCargoTypeToView = sender.tag.MainObject
            CargoArgs.argsObject = sender.tag.MainObject
            CargoArgs.argsWSFObject = WSFObjects

            RaiseEvent cmCargoTypeDetailClicked(sender, CargoArgs)
            RaiseEvent cmDetailClicked(sender, CargoArgs)

        End Sub
#End Region

#Region "LoadingDock Exception Events"
        ''' <summary>Supporting Method: The methods attached to the menu items.</summary>
        Private Sub LoadingDockExceptionRemoveLoadingDock(ByVal sender As System.Object, ByVal e As System.EventArgs)
            Dim LoadingDockExceptionArgs As New WSFObjectRemoveArgs
            LoadingDockExceptionArgs.argsLoadingDockToRemove = sender.tag.MenuItemObject
            LoadingDockExceptionArgs.argsLoadingDockExceptionToRemoveFrom = sender.tag.MainObject
            LoadingDockExceptionArgs.argsWSFObject = WSFObjects

            LoadingDockExceptionArgs.argsLoadingDockExceptionToRemoveFrom.RemoveLoadingDock(LoadingDockExceptionArgs.argsLoadingDockToRemove.LoadingDockID)

            RaiseEvent cmLoadingDockExceptionRemoveLoadingDockClicked(sender, LoadingDockExceptionArgs)

            If LoadingDockExceptionArgs.AllowRemove Then
                If BusinessRulesOnRemove Then
                    g_EventArg = LoadingDockExceptionArgs
                    g_EventArgMethod = Dialogs.EventMethods.ObjectMenu_LoadingDockExceptionRemoveLoadingDock
                    Me.timerEventSynch.Enabled = True
                Else
                    l_UpdateDataTimer.Enabled = True
                End If
            Else
                LoadingDockExceptionArgs.argsLoadingDockExceptionToRemoveFrom.AddLoadingDock(LoadingDockExceptionArgs.argsLoadingDockToRemove.LoadingDockID)
            End If

        End Sub

        ''' <summary>Supporting Method: The methods attached to the menu items.</summary>
        Private Sub LoadingDockExceptionAddLoadingDock(ByVal sender As System.Object, ByVal e As System.EventArgs)
            Dim LoadingDockExceptionArgs As New WSFObjectAddArgs
            LoadingDockExceptionArgs.argsLoadingDock = sender.tag.MenuItemObject
            LoadingDockExceptionArgs.argsLoadingDockException = sender.tag.MainObject
            LoadingDockExceptionArgs.argsWSFObject = WSFObjects

            LoadingDockExceptionArgs.argsLoadingDockException.AddLoadingDock(LoadingDockExceptionArgs.argsLoadingDock.LoadingDockID)

            RaiseEvent cmLoadingDockExceptionAddLoadingDockClicked(sender, LoadingDockExceptionArgs)

            If LoadingDockExceptionArgs.AllowAdd Then
                If BusinessRulesOnAdd Then
                    g_EventArg = LoadingDockExceptionArgs
                    g_EventArgMethod = Dialogs.EventMethods.ObjectMenu_LoadingDockExceptionAddLoadingDock
                    Me.timerEventSynch.Enabled = True
                Else
                    l_UpdateDataTimer.Enabled = True
                End If
            Else
                LoadingDockExceptionArgs.argsLoadingDockException.RemoveLoadingDock(LoadingDockExceptionArgs.argsLoadingDock.LoadingDockID)
            End If

        End Sub

        ''' <summary>Supporting Method: The methods attached to the menu items.</summary>
        Private Sub LoadingDockExceptionDetail(ByVal sender As Object, ByVal e As System.EventArgs)
            Dim LoadingDockExceptionArgs As New WSFObjectViewDetailArgs
            LoadingDockExceptionArgs.argsLoadingDockExceptionToView = sender.tag.MainObject
            LoadingDockExceptionArgs.argsObject = sender.tag.MainObject
            LoadingDockExceptionArgs.argsWSFObject = WSFObjects

            RaiseEvent cmLoadingDockExceptionDetailClicked(sender, LoadingDockExceptionArgs)
            RaiseEvent cmDetailClicked(sender, LoadingDockExceptionArgs)

        End Sub

        ''' <summary>Supporting Method: The methods attached to the menu items.</summary>
        Private Sub LoadingDockExceptionAllAffected(ByVal sender As Object, ByVal e As System.EventArgs)
            Dim LoadingDockExceptionArgs As New WSFExceptionAffectedDocksArgs
            LoadingDockExceptionArgs.argsLoadingDockException = sender.tag.MainObject
            LoadingDockExceptionArgs.argsAffectedDocks = l_AffectedLoadingDocks
            LoadingDockExceptionArgs.argsUnAffectedDocks = l_UnAffectedLoadingDocks
            LoadingDockExceptionArgs.argsWSFObject = WSFObjects

            RaiseEvent cmLoadingDockExceptionAllAffectedClicked(sender, LoadingDockExceptionArgs)

            Me.Close()

        End Sub

        ''' <summary>Supporting Method: The methods attached to the menu items.</summary>
        Private Sub LoadingDockExceptionAllUnAffected(ByVal sender As Object, ByVal e As System.EventArgs)
            Dim LoadingDockExceptionArgs As New WSFExceptionAffectedDocksArgs
            LoadingDockExceptionArgs.argsLoadingDockException = sender.tag.MainObject
            LoadingDockExceptionArgs.argsAffectedDocks = l_AffectedLoadingDocks
            LoadingDockExceptionArgs.argsUnAffectedDocks = l_UnAffectedLoadingDocks
            LoadingDockExceptionArgs.argsWSFObject = WSFObjects

            RaiseEvent cmLoadingDockExceptionAllUnAffectedClicked(sender, LoadingDockExceptionArgs)

            Me.Close()

        End Sub
#End Region

#Region "RecurrenceLoadingDock Exception Events"
        ''' <summary>Supporting Method: The methods attached to the menu items.</summary>
        Private Sub RecurrenceLoadingDockExceptionRemoveLoadingDock(ByVal sender As System.Object, ByVal e As System.EventArgs)
            Dim RecurrenceDockExceptionArgs As New WSFObjectRemoveArgs
            RecurrenceDockExceptionArgs.argsLoadingDockToRemove = sender.tag.MenuItemObject
            RecurrenceDockExceptionArgs.argsRecurrenceLoadingDockExceptionToRemoveFrom = sender.tag.MainObject
            RecurrenceDockExceptionArgs.argsWSFObject = WSFObjects

            RecurrenceDockExceptionArgs.argsRecurrenceLoadingDockExceptionToRemoveFrom.RemoveObject(RecurrenceDockExceptionArgs.argsLoadingDockToRemove.LoadingDockID)

            RaiseEvent cmRecurrenceLoadingDockExceptionRemoveLoadingDockClicked(sender, RecurrenceDockExceptionArgs)

            If RecurrenceDockExceptionArgs.AllowRemove Then
                If BusinessRulesOnRemove Then
                    g_EventArg = RecurrenceDockExceptionArgs
                    g_EventArgMethod = Dialogs.EventMethods.ObjectMenu_RecurrenceLoadingDockExceptionRemoveLoadingDock
                    Me.timerEventSynch.Enabled = True
                Else
                    l_UpdateDataTimer.Enabled = True
                End If
            Else
                RecurrenceDockExceptionArgs.argsLoadingDockExceptionToRemoveFrom.AddLoadingDock(RecurrenceDockExceptionArgs.argsLoadingDockToRemove.LoadingDockID)
            End If

        End Sub

        ''' <summary>Supporting Method: The methods attached to the menu items.</summary>
        Private Sub RecurrenceLoadingDockExceptionAddLoadingDock(ByVal sender As System.Object, ByVal e As System.EventArgs)
            Dim RecurrenceDockExceptionArgs As New WSFObjectAddArgs
            RecurrenceDockExceptionArgs.argsLoadingDock = sender.tag.MenuItemObject
            RecurrenceDockExceptionArgs.argsRecurrence = sender.tag.MainObject
            RecurrenceDockExceptionArgs.argsWSFObject = WSFObjects

            RecurrenceDockExceptionArgs.argsRecurrence.AddRecurrenceObject(RecurrenceDockExceptionArgs.argsLoadingDock.LoadingDockID)

            RaiseEvent cmRecurrenceLoadingDockExceptionAddLoadingDockClicked(sender, RecurrenceDockExceptionArgs)

            If RecurrenceDockExceptionArgs.AllowAdd Then
                If BusinessRulesOnAdd Then
                    g_EventArg = RecurrenceDockExceptionArgs
                    g_EventArgMethod = Dialogs.EventMethods.ObjectMenu_RecurrenceLoadingDockExceptionAddLoadingDock
                    Me.timerEventSynch.Enabled = True
                Else
                    l_UpdateDataTimer.Enabled = True
                End If
            Else
                RecurrenceDockExceptionArgs.argsLoadingDockException.RemoveLoadingDock(RecurrenceDockExceptionArgs.argsLoadingDock.LoadingDockID)
            End If

        End Sub

        ''' <summary>Supporting Method: The methods attached to the menu items.</summary>
        Private Sub RecurrenceLoadingDockExceptionDetail(ByVal sender As System.Object, ByVal e As System.EventArgs)
            Dim RecurrenceDockExceptionArgs As New WSFObjectViewDetailArgs
            RecurrenceDockExceptionArgs.argsRecurrenceToView = sender.tag.MainObject
            RecurrenceDockExceptionArgs.argsObject = sender.tag.MainObject
            RecurrenceDockExceptionArgs.argsWSFObject = WSFObjects

            RaiseEvent cmRecurrenceLoadingDockExceptionDetailClicked(sender, RecurrenceDockExceptionArgs)
            RaiseEvent cmDetailClicked(sender, RecurrenceDockExceptionArgs)


        End Sub

        ''' <summary>Supporting Method: The methods attached to the menu items.</summary>
        Private Sub RecurrenceLoadingDockExceptionAllAffected(ByVal sender As Object, ByVal e As System.EventArgs)
            Dim RecurrenceDockExceptionArgs As New WSFExceptionAffectedDocksArgs
            RecurrenceDockExceptionArgs.argsRecurrence = sender.tag.MainObject
            RecurrenceDockExceptionArgs.argsAffectedDocks = l_AffectedLoadingDocks
            RecurrenceDockExceptionArgs.argsUnAffectedDocks = l_UnAffectedLoadingDocks
            RecurrenceDockExceptionArgs.argsWSFObject = WSFObjects

            RaiseEvent cmRecurrenceLoadingDockExceptionAllAffectedClicked(sender, RecurrenceDockExceptionArgs)

            Me.Close()

        End Sub

        ''' <summary>Supporting Method: The methods attached to the menu items.</summary>
        Private Sub RecurrenceLoadingDockExceptionAllUnAffected(ByVal sender As Object, ByVal e As System.EventArgs)
            Dim RecurrenceDockExceptionArgs As New WSFExceptionAffectedDocksArgs
            RecurrenceDockExceptionArgs.argsRecurrence = sender.tag.MainObject
            RecurrenceDockExceptionArgs.argsAffectedDocks = l_AffectedLoadingDocks
            RecurrenceDockExceptionArgs.argsUnAffectedDocks = l_UnAffectedLoadingDocks
            RecurrenceDockExceptionArgs.argsWSFObject = WSFObjects

            RaiseEvent cmRecurrenceLoadingDockExceptionAllUnAffectedClicked(sender, RecurrenceDockExceptionArgs)

            Me.Close()

        End Sub
#End Region

#Region "Control Events"
        ''' <summary>Internal event to raise a public event, used to indicate to the developer that the Context Menu
        ''' Object has modified data.</summary>
        ''' <param name="sender"></param>
        ''' <param name="e"></param>
        Private Sub DataUpdated(ByVal sender As Object, ByVal e As System.EventArgs)
            RaiseEvent cmUpdatedData(sender, e)
        End Sub
#End Region

#End Region

#Region "public Events"

#Region "Warehouse Events"
        ''' <summary>Raises a public event from the event methods.</summary>
        Public Event cmWarehouseAddLoadingDockClicked(ByVal sender As Object, ByVal e As WSFObjectAddArgs)

        ''' <summary>Raises a public event from the event methods.</summary>
        Public Event cmWarehouseDeleteClicked(ByVal sender As Object, ByVal e As WSFObjectDeleteArgs)

        ''' <summary>Raises a public event from the event methods.</summary>
        Public Event cmWarehouseDetailClicked(ByVal sender As Object, ByVal e As WSFObjectViewDetailArgs)
#End Region

#Region "LoadingDock Events"

        ''' <summary>Raises a public event from the event methods.</summary>
        Public Event cmLoadingDockAddShipmentClicked(ByVal sender As Object, ByVal e As WSFObjectAddArgs)

        ''' <summary>Raises a public event from the event methods.</summary>
        Public Event cmLoadingDockTransferToWarehouseClicked(ByVal sender As System.Object, ByVal e As WSFObjectTransferEventArgs)

        ''' <summary>Raises a public event from the event methods.</summary>
        Public Event cmLoadingDockDeleteClicked(ByVal sender As Object, ByVal e As WSFObjectDeleteArgs)

        ''' <summary>Raises a public event from the event methods.</summary>
        Public Event cmLoadingDockCargoTypeChangeClicked(ByVal sender As Object, ByVal e As WSFLoadingDockCargoChangeArgs)

        ''' <summary>Raises a public event from the event methods.</summary>
        Public Event cmLoadingDockDetailClicked(ByVal sender As Object, ByVal e As WSFObjectViewDetailArgs)

        ''' <summary>Raises a public event from the event methods.</summary>
        Public Event cmLoadingDockCargoDetailClicked(ByVal sender As Object, ByVal e As WSFLoadingDockCargoDetailArgs)

        ''' <summary>Raises a public event from the event methods.</summary>
        Public Event cmLoadingDockAddExceptionClicked(ByVal sender As Object, ByVal e As WSFLoadingDockAddExceptionsArgs)

#End Region

#Region "Shipment Events"

        ''' <summary>Raises a public event from the event methods.</summary>
        Public Event cmShipmentAddOrderHeaderClicked(ByVal sender As Object, ByVal e As WSFObjectAddArgs)

        ''' <summary>Raises a public event from the event methods.</summary>
        Public Event cmShipmentTransferToLoadingDockClicked(ByVal sender As System.Object, ByVal e As WSFObjectTransferEventArgs)

        ''' <summary>Raises a public event from the event methods.</summary>
        Public Event cmShipmentDeleteClicked(ByVal sender As Object, ByVal e As WSFObjectDeleteArgs)

        ''' <summary>Raises a public event from the event methods.</summary>
        Public Event cmShipmentDetailClicked(ByVal sender As Object, ByVal e As WSFObjectViewDetailArgs)
#End Region

#Region "OrderHeader Events"

        ''' <summary>Raises a public event from the event methods.</summary>
        Public Event cmOrderHeaderAddOrderDetailClicked(ByVal sender As Object, ByVal e As WSFObjectAddArgs)

        ''' <summary>Raises a public event from the event methods.</summary>
        Public Event cmOrderHeaderDeleteClicked(ByVal sender As Object, ByVal e As WSFObjectDeleteArgs)

        ''' <summary>Raises a public event from the event methods.</summary>
        Public Event cmOrderHeaderDetailClicked(ByVal sender As Object, ByVal e As WSFObjectViewDetailArgs)
#End Region

#Region "OrderDetail Events"

        ''' <summary>Raises a public event from the event methods.</summary>
        Public Event cmOrderDetailCargoTypeChanged(ByVal sender As Object, ByVal e As WSFOrderDetailCargoChangeArgs)

        ''' <summary>Raises a public event from the event methods.</summary>
        Public Event cmOrderDetailDeleteClicked(ByVal sender As Object, ByVal e As WSFObjectDeleteArgs)

        ''' <summary>Raises a public event from the event methods.</summary>
        Public Event cmOrderDetailDetailClicked(ByVal sender As Object, ByVal e As WSFObjectViewDetailArgs)

#End Region

#Region "Cargo Type Events"

        ''' <summary>Raises a public event from the event methods.</summary>
        Public Event cmCargoTypeDetailClicked(ByVal sender As Object, ByVal e As WSFObjectViewDetailArgs)
#End Region

#Region "LoadingDock Exception Events"

        ''' <summary>Raises a public event from the event methods.</summary>
        Public Event cmLoadingDockExceptionRemoveLoadingDockClicked(ByVal sender As Object, ByVal e As WSFObjectRemoveArgs)

        ''' <summary>Raises a public event from the event methods.</summary>
        Public Event cmLoadingDockExceptionAddLoadingDockClicked(ByVal sender As Object, ByVal e As WSFObjectAddArgs)

        ''' <summary>Raises a public event from the event methods.</summary>
        Public Event cmLoadingDockExceptionDetailClicked(ByVal sender As Object, ByVal e As WSFObjectViewDetailArgs)

        ''' <summary>Raises a public event from the event methods.</summary>
        Public Event cmLoadingDockExceptionAllAffectedClicked(ByVal sender As Object, ByVal e As WSFExceptionAffectedDocksArgs)

        ''' <summary>Raises a public event from the event methods.</summary>
        Public Event cmLoadingDockExceptionAllUnAffectedClicked(ByVal sender As Object, ByVal e As WSFExceptionAffectedDocksArgs)
#End Region

#Region "RecurrenceLoadingDock Exception Events"

        ''' <summary>Raises a public event from the event methods.</summary>
        Public Event cmRecurrenceLoadingDockExceptionRemoveLoadingDockClicked(ByVal sender As Object, ByVal e As WSFObjectRemoveArgs)

        ''' <summary>Raises a public event from the event methods.</summary>
        Public Event cmRecurrenceLoadingDockExceptionAddLoadingDockClicked(ByVal sender As Object, ByVal e As WSFObjectAddArgs)

        ''' <summary>Raises a public event from the event methods.</summary>
        Public Event cmRecurrenceLoadingDockExceptionDetailClicked(ByVal sender As Object, ByVal e As WSFObjectViewDetailArgs)

        ''' <summary>Raises a public event from the event methods.</summary>
        Public Event cmRecurrenceLoadingDockExceptionAllAffectedClicked(ByVal sender As Object, ByVal e As WSFExceptionAffectedDocksArgs)

        ''' <summary>Raises a public event from the event methods.</summary>
        Public Event cmRecurrenceLoadingDockExceptionAllUnAffectedClicked(ByVal sender As Object, ByVal e As WSFExceptionAffectedDocksArgs)
#End Region

#Region "Control Events"
        ''' <summary>Public event to allow the developer to synch data modifications done by the Context Menu, with the
        ''' parent control(s).</summary>
        ''' <param name="sender"></param>
        ''' <param name="e"></param>
        Public Event cmUpdatedData(ByVal sender As Object, ByVal e As System.EventArgs)

        ''' <summary>Raises a public event from the event methods.</summary>
        Public Event cmDetailClicked(ByVal sender As Object, ByVal e As WSFObjectViewDetailArgs)


#End Region

#Region "Menu Built Events"

        ''' <summary>Raises a public event after the menu has been built.</summary>
        ''' <remarks>This event can be used to customize and add menu items dynamically.</remarks>
        Public Event cmShipmentMenuBuilt(ByVal sender As Object, ByVal e As WSFObjectMenuCreatedArgs)

        ''' <summary>Raises a public event after the menu has been built.</summary>
        ''' <remarks>This event can be used to customize and add menu items dynamically.</remarks>
        Public Event cmWarehouseMenuBuilt(ByVal sender As Object, ByVal e As WSFObjectMenuCreatedArgs)

        ''' <summary>Raises a public event after the menu has been built.</summary>
        ''' <remarks>This event can be used to customize and add menu items dynamically.</remarks>
        Public Event cmLoadingDockMenuBuilt(ByVal sender As Object, ByVal e As WSFObjectMenuCreatedArgs)

        ''' <summary>Raises a public event after the menu has been built.</summary>
        ''' <remarks>This event can be used to customize and add menu items dynamically.</remarks>
        Public Event cmOrderHeaderMenuBuilt(ByVal sender As Object, ByVal e As WSFObjectMenuCreatedArgs)

        ''' <summary>Raises a public event after the menu has been built.</summary>
        ''' <remarks>This event can be used to customize and add menu items dynamically.</remarks>
        Public Event cmOrderDetailMenuBuilt(ByVal sender As Object, ByVal e As WSFObjectMenuCreatedArgs)

        ''' <summary>Raises a public event after the menu has been built.</summary>
        ''' <remarks>This event can be used to customize and add menu items dynamically.</remarks>
        Public Event cmCargoTypeMenuBuilt(ByVal sender As Object, ByVal e As WSFObjectMenuCreatedArgs)

        ''' <summary>Raises a public event after the menu has been built.</summary>
        ''' <remarks>This event can be used to customize and add menu items dynamically.</remarks>
        Public Event cmLoadingDockExceptionMenuBuilt(ByVal sender As Object, ByVal e As WSFObjectMenuCreatedArgs)

        ''' <summary>Raises a public event after the menu has been built.</summary>
        ''' <remarks>This event can be used to customize and add menu items dynamically.</remarks>
        Public Event cmRecurrenceLoadingDockExceptionMenuBuilt(ByVal sender As Object, ByVal e As WSFObjectMenuCreatedArgs)
#End Region

#End Region

#Region "Supporting Classes"
        ''' <summary>Custom Class used to handle the objects stored on the various Context menu options</summary>
        Public Class ContextTagObject
            Private l_MainObject As Object = Nothing
            Private l_MenuItemObject As Object = Nothing

            Public Property MainObject() As Object
                Get
                    Return l_MainObject
                End Get
                Set(ByVal value As Object)
                    l_MainObject = value
                End Set
            End Property

            Public Property MenuItemObject() As Object
                Get
                    Return l_MenuItemObject
                End Get
                Set(ByVal value As Object)
                    l_MenuItemObject = value
                End Set
            End Property

        End Class
#End Region

#Region "Internal Timer Controls"
        ''' <summary>Custom Timer object used to fire the DataUpdate method</summary>
        Private WithEvents l_UpdateDataTimer As New System.Windows.Forms.Timer

        ''' <summary>Supporting Method: Indicates that data has been updated.</summary>
        Private Sub l_UpdateDataTimer_Tick(ByVal sender As Object, ByVal e As System.EventArgs) Handles l_UpdateDataTimer.Tick
            l_UpdateDataTimer.Enabled = False
            Dim args As New System.EventArgs
            DataUpdated(Me, args)
        End Sub

        ''' <summary>Supporting Method: Indicates that data has been updated.</summary>
        Public Sub TriggerUpdateDataTimer()
            l_UpdateDataTimer.Enabled = True
        End Sub

        ''' <summary>Custom Timer object used to synch the context menu and its business rules.</summary>
        Public WithEvents timerEventSynch As New System.Windows.Forms.Timer

        ''' <summary>Supporting Method: Fires the business rules dialog.</summary>
        Private Sub timerEventSynch_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles timerEventSynch.Tick
            Me.timerEventSynch.Enabled = False
            g_BusinessRulesDialog.StartProcess(g_EventArg, g_EventArgMethod, Me)
        End Sub
#End Region

#Region "EventArgs Classes"
        ''' <summary>Event arguments for the context menu.</summary>
        Public Class WSFObjectTransferEventArgs
            Inherits System.EventArgs

            Private l_argsLoadingDockTo As dbiWSF.FrameworkObjects.objLoadingDock = Nothing
            Private l_argsWarehouseTo As dbiWSF.FrameworkObjects.objWarehouse = Nothing
            Private l_argsLoadingDockFrom As dbiWSF.FrameworkObjects.objLoadingDock = Nothing
            Private l_argsWarehouseFrom As dbiWSF.FrameworkObjects.objWarehouse = Nothing
            Private l_argsLoadingDock As dbiWSF.FrameworkObjects.objLoadingDock = Nothing
            Private l_argsShipment As dbiWSF.FrameworkObjects.objShipment = Nothing
            Private l_argsWSFObject As dbiWSF.FrameworkObjects.objWSFObjects = Nothing
            Private l_AllowTransfer As Boolean = True

            Public Property argsLoadingDockTo() As dbiWSF.FrameworkObjects.objLoadingDock
                Get
                    Return l_argsLoadingDockTo
                End Get
                Set(ByVal value As dbiWSF.FrameworkObjects.objLoadingDock)
                    l_argsLoadingDockTo = value
                End Set
            End Property

            Public Property argsWarehouseTo() As dbiWSF.FrameworkObjects.objWarehouse
                Get
                    Return l_argsWarehouseTo
                End Get
                Set(ByVal value As dbiWSF.FrameworkObjects.objWarehouse)
                    l_argsWarehouseTo = value
                End Set
            End Property

            Public Property argsLoadingDockFrom() As dbiWSF.FrameworkObjects.objLoadingDock
                Get
                    Return l_argsLoadingDockFrom
                End Get
                Set(ByVal value As dbiWSF.FrameworkObjects.objLoadingDock)
                    l_argsLoadingDockFrom = value
                End Set
            End Property

            Public Property argsWarehouseFrom() As dbiWSF.FrameworkObjects.objWarehouse
                Get
                    Return l_argsWarehouseFrom
                End Get
                Set(ByVal value As dbiWSF.FrameworkObjects.objWarehouse)
                    l_argsWarehouseFrom = value
                End Set
            End Property

            Public Property argsLoadingDock() As dbiWSF.FrameworkObjects.objLoadingDock
                Get
                    Return l_argsLoadingDock
                End Get
                Set(ByVal value As dbiWSF.FrameworkObjects.objLoadingDock)
                    l_argsLoadingDock = value
                End Set
            End Property

            Public Property argsShipment() As dbiWSF.FrameworkObjects.objShipment
                Get
                    Return l_argsShipment
                End Get
                Set(ByVal value As dbiWSF.FrameworkObjects.objShipment)
                    l_argsShipment = value
                End Set
            End Property

            Public Property argsWSFObject() As dbiWSF.FrameworkObjects.objWSFObjects
                Get
                    Return l_argsWSFObject
                End Get
                Set(ByVal value As dbiWSF.FrameworkObjects.objWSFObjects)
                    l_argsWSFObject = value
                End Set
            End Property

            Public Property AllowTransfer() As Boolean
                Get
                    Return l_AllowTransfer
                End Get
                Set(ByVal value As Boolean)
                    l_AllowTransfer = value
                End Set
            End Property
        End Class

        ''' <summary>Event arguments for the context menu.</summary>
        Public Class WSFObjectRemoveArgs
            Inherits System.EventArgs

            Private l_argsLoadingDockToRemove As dbiWSF.FrameworkObjects.objLoadingDock = Nothing
            Private l_argsShipmentToRemove As dbiWSF.FrameworkObjects.objShipment = Nothing
            Private l_argsLoadingDockExceptionToRemoveFrom As dbiWSF.FrameworkObjects.objLoadingDockException = Nothing
            Private l_argsRecurrenceLoadingDockExceptionToRemoveFrom As dbiWSF.FrameworkObjects.objRecurrence = Nothing
            Private l_argsRecurrenceShipmentToRemoveFrom As dbiWSF.FrameworkObjects.objRecurrence = Nothing
            Private l_argsWSFObject As dbiWSF.FrameworkObjects.objWSFObjects = Nothing
            Private l_AllowRemove As Boolean = True

            Public Property argsLoadingDockToRemove() As dbiWSF.FrameworkObjects.objLoadingDock
                Get
                    Return l_argsLoadingDockToRemove
                End Get
                Set(ByVal value As dbiWSF.FrameworkObjects.objLoadingDock)
                    l_argsLoadingDockToRemove = value
                End Set
            End Property

            Public Property argsShipmentToRemove() As dbiWSF.FrameworkObjects.objShipment
                Get
                    Return l_argsShipmentToRemove
                End Get
                Set(ByVal value As dbiWSF.FrameworkObjects.objShipment)
                    l_argsShipmentToRemove = value
                End Set
            End Property

            Public Property argsLoadingDockExceptionToRemoveFrom() As dbiWSF.FrameworkObjects.objLoadingDockException
                Get
                    Return l_argsLoadingDockExceptionToRemoveFrom
                End Get
                Set(ByVal value As dbiWSF.FrameworkObjects.objLoadingDockException)
                    l_argsLoadingDockExceptionToRemoveFrom = value
                End Set
            End Property

            Public Property argsRecurrenceLoadingDockExceptionToRemoveFrom() As dbiWSF.FrameworkObjects.objRecurrence
                Get
                    Return l_argsRecurrenceLoadingDockExceptionToRemoveFrom
                End Get
                Set(ByVal value As dbiWSF.FrameworkObjects.objRecurrence)
                    l_argsRecurrenceLoadingDockExceptionToRemoveFrom = value
                End Set
            End Property

            Public Property argsRecurrenceShipmentToRemoveFrom() As dbiWSF.FrameworkObjects.objRecurrence
                Get
                    Return l_argsRecurrenceShipmentToRemoveFrom
                End Get
                Set(ByVal value As dbiWSF.FrameworkObjects.objRecurrence)
                    l_argsRecurrenceShipmentToRemoveFrom = value
                End Set
            End Property

            Public Property argsWSFObject() As dbiWSF.FrameworkObjects.objWSFObjects
                Get
                    Return l_argsWSFObject
                End Get
                Set(ByVal value As dbiWSF.FrameworkObjects.objWSFObjects)
                    l_argsWSFObject = value
                End Set
            End Property

            Public Property AllowRemove() As Boolean
                Get
                    Return l_AllowRemove
                End Get
                Set(ByVal value As Boolean)
                    l_AllowRemove = value
                End Set
            End Property
        End Class

        ''' <summary>Event arguments for the context menu.</summary>
        Public Class WSFObjectDeleteArgs
            Inherits System.EventArgs

            Private l_argsWarehouseToDelete As dbiWSF.FrameworkObjects.objWarehouse = Nothing
            Private l_argsLoadingDockToDelete As dbiWSF.FrameworkObjects.objLoadingDock = Nothing
            Private l_argsShipmentToDelete As dbiWSF.FrameworkObjects.objShipment = Nothing
            Private l_argsOrderHeaderToDelete As dbiWSF.FrameworkObjects.objOrderHeader = Nothing
            Private l_argsOrderDetailToDelete As dbiWSF.FrameworkObjects.objOrderDetail = Nothing

            Private l_argsWSFObject As dbiWSF.FrameworkObjects.objWSFObjects = Nothing
            Private l_AllowDelete As Boolean = True

            Public Property argsWarehouseToDelete() As dbiWSF.FrameworkObjects.objWarehouse
                Get
                    Return l_argsWarehouseToDelete
                End Get
                Set(ByVal value As dbiWSF.FrameworkObjects.objWarehouse)
                    l_argsWarehouseToDelete = value
                End Set
            End Property

            Public Property argsLoadingDockToDelete() As dbiWSF.FrameworkObjects.objLoadingDock
                Get
                    Return l_argsLoadingDockToDelete
                End Get
                Set(ByVal value As dbiWSF.FrameworkObjects.objLoadingDock)
                    l_argsLoadingDockToDelete = value
                End Set
            End Property

            Public Property argsShipmentToDelete() As dbiWSF.FrameworkObjects.objShipment
                Get
                    Return l_argsShipmentToDelete
                End Get
                Set(ByVal value As dbiWSF.FrameworkObjects.objShipment)
                    l_argsShipmentToDelete = value
                End Set
            End Property

            Public Property argsOrderHeaderToDelete() As dbiWSF.FrameworkObjects.objOrderHeader
                Get
                    Return l_argsOrderHeaderToDelete
                End Get
                Set(ByVal value As dbiWSF.FrameworkObjects.objOrderHeader)
                    l_argsOrderHeaderToDelete = value
                End Set
            End Property

            Public Property argsOrderDetailToDelete() As dbiWSF.FrameworkObjects.objOrderDetail
                Get
                    Return l_argsOrderDetailToDelete
                End Get
                Set(ByVal value As dbiWSF.FrameworkObjects.objOrderDetail)
                    l_argsOrderDetailToDelete = value
                End Set
            End Property


            Public Property argsWSFObject() As dbiWSF.FrameworkObjects.objWSFObjects
                Get
                    Return l_argsWSFObject
                End Get
                Set(ByVal value As dbiWSF.FrameworkObjects.objWSFObjects)
                    l_argsWSFObject = value
                End Set
            End Property

            Public Property AllowDelete() As Boolean
                Get
                    Return l_AllowDelete
                End Get
                Set(ByVal value As Boolean)
                    l_AllowDelete = value
                End Set
            End Property
        End Class

        ''' <summary>Event arguments for the context menu.</summary>
        Public Class WSFObjectAddArgs
            Inherits System.EventArgs

            Private l_argsWarehouse As dbiWSF.FrameworkObjects.objWarehouse = Nothing
            Private l_argsLoadingDock As dbiWSF.FrameworkObjects.objLoadingDock = Nothing
            Private l_argsShipment As dbiWSF.FrameworkObjects.objShipment = Nothing
            Private l_argsOrderHeader As dbiWSF.FrameworkObjects.objOrderHeader = Nothing
            Private l_argsLoadingDockException As dbiWSF.FrameworkObjects.objLoadingDockException = Nothing
            Private l_argsRecurrence As dbiWSF.FrameworkObjects.objRecurrence = Nothing
            Private l_AllowAdd As Boolean = True

            Private l_argsWSFObject As dbiWSF.FrameworkObjects.objWSFObjects = Nothing

            Public Property argsWarehouse() As dbiWSF.FrameworkObjects.objWarehouse
                Get
                    Return l_argsWarehouse
                End Get
                Set(ByVal value As dbiWSF.FrameworkObjects.objWarehouse)
                    l_argsWarehouse = value
                End Set
            End Property

            Public Property argsLoadingDock() As dbiWSF.FrameworkObjects.objLoadingDock
                Get
                    Return l_argsLoadingDock
                End Get
                Set(ByVal value As dbiWSF.FrameworkObjects.objLoadingDock)
                    l_argsLoadingDock = value
                End Set
            End Property

            Public Property argsShipment() As dbiWSF.FrameworkObjects.objShipment
                Get
                    Return l_argsShipment
                End Get
                Set(ByVal value As dbiWSF.FrameworkObjects.objShipment)
                    l_argsShipment = value
                End Set
            End Property

            Public Property argsOrderHeader() As dbiWSF.FrameworkObjects.objOrderHeader
                Get
                    Return l_argsOrderHeader
                End Get
                Set(ByVal value As dbiWSF.FrameworkObjects.objOrderHeader)
                    l_argsOrderHeader = value
                End Set
            End Property

            Public Property argsLoadingDockException() As dbiWSF.FrameworkObjects.objLoadingDockException
                Get
                    Return l_argsLoadingDockException
                End Get
                Set(ByVal value As dbiWSF.FrameworkObjects.objLoadingDockException)
                    l_argsLoadingDockException = value
                End Set
            End Property

            Public Property argsRecurrence() As dbiWSF.FrameworkObjects.objRecurrence
                Get
                    Return l_argsRecurrence
                End Get
                Set(ByVal value As dbiWSF.FrameworkObjects.objRecurrence)
                    l_argsRecurrence = value
                End Set
            End Property

            Public Property AllowAdd() As Boolean
                Get
                    Return l_AllowAdd
                End Get
                Set(ByVal value As Boolean)
                    l_AllowAdd = value
                End Set
            End Property

            Public Property argsWSFObject() As dbiWSF.FrameworkObjects.objWSFObjects
                Get
                    Return l_argsWSFObject
                End Get
                Set(ByVal value As dbiWSF.FrameworkObjects.objWSFObjects)
                    l_argsWSFObject = value
                End Set
            End Property
        End Class

        ''' <summary>Event arguments for the context menu.</summary>
        Public Class WSFObjectViewDetailArgs
            Inherits System.EventArgs

            Private l_argsObject As Object = Nothing
            Private l_argsWarehouseToView As dbiWSF.FrameworkObjects.objWarehouse = Nothing
            Private l_argsLoadingDockToView As dbiWSF.FrameworkObjects.objLoadingDock = Nothing
            Private l_argsShipmentToView As dbiWSF.FrameworkObjects.objShipment = Nothing
            Private l_argsOrderHeaderToView As dbiWSF.FrameworkObjects.objOrderHeader = Nothing
            Private l_argsOrderDetailToView As dbiWSF.FrameworkObjects.objOrderDetail = Nothing
            Private l_argsLoadingDockExceptionToView As dbiWSF.FrameworkObjects.objLoadingDockException = Nothing
            Private l_argsRecurrenceToView As dbiWSF.FrameworkObjects.objRecurrence = Nothing
            Private l_argsCargoTypeToView As dbiWSF.FrameworkObjects.objCargoType = Nothing

            Private l_WSFObject As dbiWSF.FrameworkObjects.objWSFObjects = Nothing

            Public Property argsObject() As Object
                Get
                    Return l_argsObject
                End Get
                Set(ByVal value As Object)
                    l_argsObject = value
                End Set
            End Property

            Public Property argsWarehouseToView() As dbiWSF.FrameworkObjects.objWarehouse
                Get
                    Return l_argsWarehouseToView
                End Get
                Set(ByVal value As dbiWSF.FrameworkObjects.objWarehouse)
                    l_argsWarehouseToView = value
                End Set
            End Property

            Public Property argsLoadingDockToView() As dbiWSF.FrameworkObjects.objLoadingDock
                Get
                    Return l_argsLoadingDockToView
                End Get
                Set(ByVal value As dbiWSF.FrameworkObjects.objLoadingDock)
                    l_argsLoadingDockToView = value
                End Set
            End Property

            Public Property argsShipmentToView() As dbiWSF.FrameworkObjects.objShipment
                Get
                    Return l_argsShipmentToView
                End Get
                Set(ByVal value As dbiWSF.FrameworkObjects.objShipment)
                    l_argsShipmentToView = value
                End Set
            End Property

            Public Property argsOrderHeaderToView() As dbiWSF.FrameworkObjects.objOrderHeader
                Get
                    Return l_argsOrderHeaderToView
                End Get
                Set(ByVal value As dbiWSF.FrameworkObjects.objOrderHeader)
                    l_argsOrderHeaderToView = value
                End Set
            End Property

            Public Property argsOrderDetailToView() As dbiWSF.FrameworkObjects.objOrderDetail
                Get
                    Return l_argsOrderDetailToView
                End Get
                Set(ByVal value As dbiWSF.FrameworkObjects.objOrderDetail)
                    l_argsOrderDetailToView = value
                End Set
            End Property

            Public Property argsLoadingDockExceptionToView() As dbiWSF.FrameworkObjects.objLoadingDockException
                Get
                    Return l_argsLoadingDockExceptionToView
                End Get
                Set(ByVal value As dbiWSF.FrameworkObjects.objLoadingDockException)
                    l_argsLoadingDockExceptionToView = value
                End Set
            End Property

            Public Property argsRecurrenceToView() As dbiWSF.FrameworkObjects.objRecurrence
                Get
                    Return l_argsRecurrenceToView
                End Get
                Set(ByVal value As dbiWSF.FrameworkObjects.objRecurrence)
                    l_argsRecurrenceToView = value
                End Set
            End Property

            Public Property argsCargoTypeToView() As dbiWSF.FrameworkObjects.objCargoType
                Get
                    Return l_argsCargoTypeToView
                End Get
                Set(ByVal value As dbiWSF.FrameworkObjects.objCargoType)
                    l_argsCargoTypeToView = value
                End Set
            End Property

            Public Property argsWSFObject() As dbiWSF.FrameworkObjects.objWSFObjects
                Get
                    Return l_WSFObject
                End Get
                Set(ByVal value As dbiWSF.FrameworkObjects.objWSFObjects)
                    l_WSFObject = value
                End Set
            End Property
        End Class

        ''' <summary>Event arguments for the context menu.</summary>
        Public Class WSFExceptionAffectedDocksArgs
            Inherits System.EventArgs

            Private l_argsLoadingDockException As dbiWSF.FrameworkObjects.objLoadingDockException = Nothing
            Private l_argsRecurrence As dbiWSF.FrameworkObjects.objRecurrence = Nothing
            Private l_argsAffectedDocks As New System.Collections.Generic.List(Of dbiWSF.FrameworkObjects.objLoadingDock)
            Private l_argsUnAffectedDocks As New System.Collections.Generic.List(Of dbiWSF.FrameworkObjects.objLoadingDock)
            Private l_argsWSFObject As dbiWSF.FrameworkObjects.objWSFObjects = Nothing

            Public Property argsLoadingDockException() As dbiWSF.FrameworkObjects.objLoadingDockException
                Get
                    Return l_argsLoadingDockException
                End Get
                Set(ByVal value As dbiWSF.FrameworkObjects.objLoadingDockException)
                    l_argsLoadingDockException = value
                End Set
            End Property

            Public Property argsRecurrence() As dbiWSF.FrameworkObjects.objRecurrence
                Get
                    Return l_argsRecurrence
                End Get
                Set(ByVal value As dbiWSF.FrameworkObjects.objRecurrence)
                    l_argsRecurrence = value
                End Set
            End Property

            Public Property argsAffectedDocks() As System.Collections.Generic.List(Of dbiWSF.FrameworkObjects.objLoadingDock)
                Get
                    Return l_argsAffectedDocks
                End Get
                Set(ByVal value As System.Collections.Generic.List(Of dbiWSF.FrameworkObjects.objLoadingDock))
                    l_argsAffectedDocks = value
                End Set
            End Property

            Public Property argsUnAffectedDocks() As System.Collections.Generic.List(Of dbiWSF.FrameworkObjects.objLoadingDock)
                Get
                    Return l_argsUnAffectedDocks
                End Get
                Set(ByVal value As System.Collections.Generic.List(Of dbiWSF.FrameworkObjects.objLoadingDock))
                    l_argsUnAffectedDocks = value
                End Set
            End Property

            Public Property argsWSFObject() As dbiWSF.FrameworkObjects.objWSFObjects
                Get
                    Return l_argsWSFObject
                End Get
                Set(ByVal value As dbiWSF.FrameworkObjects.objWSFObjects)
                    l_argsWSFObject = value
                End Set
            End Property
        End Class

        ''' <summary>Event arguments for the context menu.</summary>
        Public Class WSFOrderDetailCargoChangeArgs
            Inherits System.EventArgs

            Private l_argsOldCargoType As dbiWSF.FrameworkObjects.objCargoType = Nothing
            Private l_argsNewCargoType As dbiWSF.FrameworkObjects.objCargoType = Nothing
            Private l_argsOrderDetail As dbiWSF.FrameworkObjects.objOrderDetail = Nothing
            Private l_AllowChange As Boolean = True
            Private l_argsWSFObject As dbiWSF.FrameworkObjects.objWSFObjects = Nothing

            Public Property argsOldCargoType() As dbiWSF.FrameworkObjects.objCargoType
                Get
                    Return l_argsOldCargoType
                End Get
                Set(ByVal value As dbiWSF.FrameworkObjects.objCargoType)
                    l_argsOldCargoType = value
                End Set
            End Property

            Public Property argsNewCargoType() As dbiWSF.FrameworkObjects.objCargoType
                Get
                    Return l_argsNewCargoType
                End Get
                Set(ByVal value As dbiWSF.FrameworkObjects.objCargoType)
                    l_argsNewCargoType = value
                End Set
            End Property

            Public Property argsOrderDetail() As dbiWSF.FrameworkObjects.objOrderDetail
                Get
                    Return l_argsOrderDetail
                End Get
                Set(ByVal value As dbiWSF.FrameworkObjects.objOrderDetail)
                    l_argsOrderDetail = value
                End Set
            End Property

            Public Property AllowChange() As Boolean
                Get
                    Return l_AllowChange
                End Get
                Set(ByVal value As Boolean)
                    l_AllowChange = value
                End Set
            End Property

            Public Property argsWSFObject() As dbiWSF.FrameworkObjects.objWSFObjects
                Get
                    Return l_argsWSFObject
                End Get
                Set(ByVal value As dbiWSF.FrameworkObjects.objWSFObjects)
                    l_argsWSFObject = value
                End Set
            End Property
        End Class

        ''' <summary>Event arguments for the context menu.</summary>
        Public Class WSFLoadingDockCargoChangeArgs
            Inherits System.EventArgs

            Public Enum CargoChangeStatus
                ToRemove = 0
                toAdd = 1
            End Enum

            Private l_argsLoadingDock As dbiWSF.FrameworkObjects.objLoadingDock = Nothing
            Private l_argsCargoType As dbiWSF.FrameworkObjects.objCargoType = Nothing
            Private l_AllowChange As Boolean = True
            Private l_argsChangeStatus As CargoChangeStatus
            Private l_argsWSFObject As dbiWSF.FrameworkObjects.objWSFObjects = Nothing

            Public Property argsLoadingDock() As dbiWSF.FrameworkObjects.objLoadingDock
                Get
                    Return l_argsLoadingDock
                End Get
                Set(ByVal value As dbiWSF.FrameworkObjects.objLoadingDock)
                    l_argsLoadingDock = value
                End Set
            End Property

            Public Property argsCargoType() As dbiWSF.FrameworkObjects.objCargoType
                Get
                    Return l_argsCargoType
                End Get
                Set(ByVal value As dbiWSF.FrameworkObjects.objCargoType)
                    l_argsCargoType = value
                End Set
            End Property

            Public Property AllowChange() As Boolean
                Get
                    Return l_AllowChange
                End Get
                Set(ByVal value As Boolean)
                    l_AllowChange = value
                End Set
            End Property

            Public Property argsChangeStatus() As CargoChangeStatus
                Get
                    Return l_argsChangeStatus
                End Get
                Set(ByVal value As CargoChangeStatus)
                    l_argsChangeStatus = value
                End Set
            End Property

            Public Property argsWSFObject() As dbiWSF.FrameworkObjects.objWSFObjects
                Get
                    Return l_argsWSFObject
                End Get
                Set(ByVal value As dbiWSF.FrameworkObjects.objWSFObjects)
                    l_argsWSFObject = value
                End Set
            End Property

        End Class

        ''' <summary>Event arguments for the context menu.</summary>
        Public Class WSFLoadingDockCargoDetailArgs
            Inherits System.EventArgs

            Private l_argsLoadingDock As dbiWSF.FrameworkObjects.objLoadingDock = Nothing
            Private l_argsAcceptedCargos As New System.Collections.Generic.List(Of dbiWSF.FrameworkObjects.objCargoType)
            Private l_argsUnAcceptedCargos As New System.Collections.Generic.List(Of dbiWSF.FrameworkObjects.objCargoType)
            Private l_argsWSFObject As dbiWSF.FrameworkObjects.objWSFObjects = Nothing

            Public Property argsLoadingDock() As dbiWSF.FrameworkObjects.objLoadingDock
                Get
                    Return l_argsLoadingDock
                End Get
                Set(ByVal value As dbiWSF.FrameworkObjects.objLoadingDock)
                    l_argsLoadingDock = value
                End Set
            End Property

            Public Property argsAcceptedCargos() As System.Collections.Generic.List(Of dbiWSF.FrameworkObjects.objCargoType)
                Get
                    Return l_argsAcceptedCargos
                End Get
                Set(ByVal value As System.Collections.Generic.List(Of dbiWSF.FrameworkObjects.objCargoType))
                    l_argsAcceptedCargos = value
                End Set
            End Property

            Public Property argsUnAcceptedCargos() As System.Collections.Generic.List(Of dbiWSF.FrameworkObjects.objCargoType)
                Get
                    Return l_argsUnAcceptedCargos
                End Get
                Set(ByVal value As System.Collections.Generic.List(Of dbiWSF.FrameworkObjects.objCargoType))
                    l_argsUnAcceptedCargos = value
                End Set
            End Property

            Public Property argsWSFObject() As dbiWSF.FrameworkObjects.objWSFObjects
                Get
                    Return l_argsWSFObject
                End Get
                Set(ByVal value As dbiWSF.FrameworkObjects.objWSFObjects)
                    l_argsWSFObject = value
                End Set
            End Property

        End Class

        ''' <summary>Event arguments for the context menu.</summary>
        Public Class WSFLoadingDockAddExceptionsArgs
            Inherits System.EventArgs

            Public Enum ExceptionType
                LoadingDockException = 0
                LoadingDockRecurrence = 1
            End Enum
            Private l_argsDateTimeAt As DateTime
            Private l_argsLoadingDock As dbiWSF.FrameworkObjects.objLoadingDock
            Private l_argsExceptionType As ExceptionType
            Private l_argsWSFObject As dbiWSF.FrameworkObjects.objWSFObjects

            Public Property argsDateTimeAt() As DateTime
                Get
                    Return l_argsDateTimeAt
                End Get
                Set(ByVal value As DateTime)
                    l_argsDateTimeAt = value
                End Set
            End Property

            Public Property argsLoadingDock() As dbiWSF.FrameworkObjects.objLoadingDock
                Get
                    Return l_argsLoadingDock
                End Get
                Set(ByVal value As dbiWSF.FrameworkObjects.objLoadingDock)
                    l_argsLoadingDock = value
                End Set
            End Property

            Public Property argsExceptionType() As ExceptionType
                Get
                    Return l_argsExceptionType
                End Get
                Set(ByVal value As ExceptionType)
                    l_argsExceptionType = value
                End Set
            End Property

            Public Property argsWSFObject() As dbiWSF.FrameworkObjects.objWSFObjects
                Get
                    Return l_argsWSFObject
                End Get
                Set(ByVal value As dbiWSF.FrameworkObjects.objWSFObjects)
                    l_argsWSFObject = value
                End Set
            End Property


        End Class

        ''' <summary>Event arguments for the context menu.</summary>
        Public Class WSFObjectMenuCreatedArgs
            Inherits System.EventArgs

            Private l_ObjectMenu As System.Windows.Forms.ToolStripMenuItem
            Private l_WSFObject As System.Object

            Public Property ObjectMenu() As System.Windows.Forms.ToolStripMenuItem
                Get
                    Return l_ObjectMenu
                End Get
                Set(ByVal value As System.Windows.Forms.ToolStripMenuItem)
                    l_ObjectMenu = value
                End Set
            End Property

            Public Property WSFObject() As System.Object
                Get
                    Return l_WSFObject
                End Get
                Set(ByVal value As System.Object)
                    l_WSFObject = value
                End Set
            End Property

        End Class


#End Region

    End Class




End Namespace
